Reputation: 1725
Does any one know how to close an xsockets socket.
There is no api for server or client side to show how to close a socket.
There is an event one can bind to "close" on client side but it says that "this will get called when server closes the websocket"
How can you close the websocket from the client side or from the serverside.
I extracted the socket object from xsocketcontroller and called close() on it but no luck. client side close did not get called.
Upvotes: 1
Views: 408
Reputation: 2275
This is not well in the documentation I´m afraid. Will fix that a.s.a.p
You have a few options. The first ones is how to close the connection from the client. However, you will also see in the example code that you can call close from serverside.
See the examples at pastebin:
HTML: HowTo Close From JavaScript
Controller: HowTo Close From Server (or handle close request from client)
Upvotes: 1