Property that contains the functions and properties related with the SockJS client library.
Members
-
<static, readonly> websocketLast :Object|null
-
Keeps the last SockJS created.
Type:
- Object | null
Methods
-
<static> close( [websocket] [, onError]) → {undefined|false}
-
Tries to close the websockets connection. Using the SockJS client library internally.
Parameters:
Name Type Argument Default Description websocketfunction <optional>
CB_Net.Sockets.SockJS.websocketLastThe SockJS object that we want to use. If not provided, it will try to use the last one created (if any) which is stored in
CB_Net.Sockets.SockJS.websocketLast.onErrorfunction <optional>
Function for the event "onerror" used by the SockJS object. If provided, it will replace the previous one (if any). Following the same rules as in the SockJS client library documentation.
Returns:
Returns undefined (the same as the "close" function of the SockJS object) if the SockJS has been used or false otherwise.
- Type
- undefined | false
-
<static> listen(serverURL [, onOpen] [, onClose] [, onMessage] [, onError] [, options] [, protocols]) → {Object|null}
-
Creates the websockets object and sets the listeners. Using the SockJS client library internally.
Parameters:
Name Type Argument Description serverURLstring The URL of the SockJS server. This will be used as the first parameter when it calls the constructor of SockJS internally. Following the same rules as in the SockJS client library documentation (the parameter is called "url").
onOpenfunction <optional>
Function for the event "onopen" used by the SockJS object. Following the same rules as in the SockJS client library documentation.
onClosefunction <optional>
Function for the event "onclose" used by the SockJS object. Following the same rules as in the SockJS client library documentation.
onMessagefunction <optional>
Function for the event "onmessage" used by the SockJS object. Following the same rules as in the SockJS client library documentation.
onErrorfunction <optional>
Function for the event "onerror" used by the SockJS object. Following the same rules as in the SockJS client library documentation.
optionsObject <optional>
The desired options for the SockJS object. This will be used as the third parameter when it calls the constructor of SockJS internally. Following the same rules as in the SockJS client library documentation (the parameter is called "options").
protocolsarray <optional>
This will be used as the second parameter when it calls the constructor of SockJS internally. Following the same rules as in the SockJS client library documentation (the parameter is called "_reserved").
Returns:
Returns a SockJS object. Read the SockJS client library documentation for more information. In the case of error, returns null.
- Type
- Object | null
-
<static> open()
-
Alias for
CB_Net.Sockets.SockJS.listen. -
<static> send(message [, websocket] [, onError]) → {undefined|false}
-
Sends a websockets message. Using the SockJS client library internally.
Parameters:
Name Type Argument Default Description messagestring The message that we want to send. This will be used as the first and unique parameter when it calls the "send" function of the SockJS object internally. Following the same rules as in the SockJS client library documentation.
websocketfunction <optional>
CB_Net.Sockets.SockJS.websocketLastThe SockJS object that we want to use. If not provided, it will try to use the last one created (if any) which is stored in
CB_Net.Sockets.SockJS.websocketLast.onErrorfunction <optional>
Function for the event "onerror" used by the SockJS object. If provided, it will replace the previous one (if any). Following the same rules as in the SockJS client library documentation.
Returns:
Returns undefined (the same as the "send" function of the SockJS object) if the SockJS has been used or false otherwise.
- Type
- undefined | false