I'm using Glassfish 3.1.2.2 that supports JEE 6. We have a JAX-WS web service and a client. The client has timeouts set so that is disconnect after 30 seconds. Is there a way to detect when a client gets a timeout on server? Is there a way to detect when client disconnects from server?
As far as I know, you could not detect that the client disconnected from server without trying to perform reading or writing. To determine that the client is disconnected the server must send a packet. If the connection is closed will be thrown IOException.
Related
I have multiple devices sending messages to a mosquito broker. I would like to manage a kind of device revocation so that when a device is revoked, I want the mosquito broker to automatically close the connection for this specific device.
Is there any command or way to ask the broker to explicitly close a connection to a specific client?
Thanks in advance,
hak
I do not think you can kick an already connected client.
But what you can do if using the Authentication Plugin (either a 3rd party or the included dynamic security plugin) to change the ACL that the user can publish/subscribe to which should effectively stop the client sending or receiving any messages and when it next tries to connect it will not be allowed.
We have an mqtt server (VerneMq on Linux VM on Azure) which is configured like below
max_inflight_messages=500
upgrade_outgoing_qos=on
max_offline_messages=1000000
max_online_messages=1000000
persistent_client_expiration=1w
in addition to it's default configuration.
In order to test the persistent message mechanism, we created the following scenario:
We fed the server with some test messages and wait couple of minutes before subscribing with the client (with cleanSession = false), we were able to receive all the messages.
But if we do the same thing and wait 24 hours, we can not receive all stored messages, even if we can see awaiting messages for that client with
vmq-admin trace client client-id=<client_id>
Broker and client both use qos=2.
Is there any other configuration on client or server we have to change?
I have a web api that posts json to different external endpoints on certain conditions. We have a new client that wants us to open a web socket connection with them during an event, send them the data (json) when we get it via this socket, and close the socket after the event. I'm having a hard time figuring out the rails way to do this.
How do I open a web socket connection and keep it open? (basically where would the client sit/ what would the definition look like).
How do I send messages over the socket from a controller? (eg. after processing a post request send new data to this websocket)
How do I close the connection?
You can try using this gem called Faye. Here's an example for connecting and sending data: (note: I didn't test it)
# Open the connection
ws = Faye::WebSocket::Client.new('ws://www.example.com/')
# Send data to connection
ws.send(YOURJSONDATA)
# Close connection (RFC 6455)
ws.close
Notes for faye:
Using the WebSocket client
Adding headers and other options to connection
WebSocket API
RFC 6455
Hope it helps!
I've created a program that send's a data to a webserver. I used the NSURLConnection to send the data to the web server. I've created a php file on my server to handle all the POST request from the iPhone. My question was are there any other ways to send the data to a web Server besides using WiFi connection. I just only need to send small data.
are there any other ways to send the
data to a web Server besides using
wifi connection
Yes, EDGE and 3G
I've created a project using socket programming. If I connect a single client to my server, the data I send from my client is successfully received by the server. But whenever I connect more than one client, only one client's data is received by the server. The other clients fail to connect. How can I make the server accept all new incoming connections, and how can I make the server receive two files from the same client?
If your code uses BeginAccept, EndAccept methods to accept new connection asynchonously, don't forget to call again BeginAccept after EndAccept call in your AcceptCallback.
Regards