Mixin: Stomp
Defined in: | src/stomp.coffee |
Overview
Stomp exposes methods to instantiate Client.
Method Summary
- ~ (void) client(url, protocols = ['v10.stomp', 'v11.stomp', 'v12.stomp']) This method creates a WebSocket client that is connected to the STOMP server located at the url.
-
~
(void)
over(ws)
This method is an alternative to
Stomp.client()
to let the user specify the WebSocket to use (either a standard HTML5 WebSocket or a similar object).
Method Details
~
(void)
client(url, protocols = ['v10.stomp', 'v11.stomp', 'v12.stomp'])
This method creates a WebSocket client that is connected to the STOMP server located at the url.
Examples:
var url = "ws://localhost:61614/stomp";
var client = Stomp.client(url);
~
(void)
over(ws)
This method is an alternative to Stomp.client()
to let the user
specify the WebSocket to use (either a standard HTML5 WebSocket or
a similar object).
In order to support reconnection, the function Client._connect should be callable more than once. While reconnecting a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function alternatively allows passing a function that should return a new instance of the underlying socket.
Examples:
var client = Stomp.over(function(){
return new WebSocket('ws://localhost:15674/ws')
});