Basic WebSocket class.
The close
event is fired, when the connection was closed.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
code | string |
Close code provided by the server. |
reason | string |
Reason from server for closing the connection. |
wasClean | string |
Indicates whether the connection was cleanly closed or not. |
The error
event is fired, when an error occurred.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object |
Method | Description |
---|---|
attachClose |
Attaches event handler When called, the context of the event handler (its |
attachError |
Attaches event handler When called, the context of the event handler (its |
attachMessage |
Attaches event handler When called, the context of the event handler (its |
attachOpen |
Attaches event handler When called, the context of the event handler (its |
close |
Closes the connection. |
detachClose |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachError |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachMessage |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachOpen |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.core.ws.WebSocket.extend |
Creates a new subclass of class sap.ui.core.ws.WebSocket with name
|
fireClose |
Fires event close to attached listeners. |
fireError |
Fires event error to attached listeners. |
fireMessage |
Fires event message to attached listeners. |
fireOpen |
Fires event open to attached listeners. |
getInterface |
|
sap.ui.core.ws.WebSocket.getMetadata |
Returns a metadata object for class sap.ui.core.ws.WebSocket. |
getProtocol |
Getter for the protocol selected by the server once the connection is open. |
getReadyState |
Getter for WebSocket readyState. |
send |
Sends a message. If the connection is not yet opened, the message will be queued and sent when the connection is established. |
Attaches event handler fnFunction
to the close event of this sap.ui.core.ws.WebSocket
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.ws.WebSocket
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the error event of this sap.ui.core.ws.WebSocket
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.ws.WebSocket
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the message event of this sap.ui.core.ws.WebSocket
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.ws.WebSocket
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the open event of this sap.ui.core.ws.WebSocket
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.ws.WebSocket
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Closes the connection.
Param | Type | DefaultValue | Description |
---|---|---|---|
iCode | int | 1000 |
Status code that explains why the connection is closed. Must either be 1000, or between 3000 and 4999 |
sReason | string |
Closing reason as a string |
Detaches event handler fnFunction
from the close event of this sap.ui.core.ws.WebSocket
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to call, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the error event of this sap.ui.core.ws.WebSocket
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to call, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the message event of this sap.ui.core.ws.WebSocket
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to call, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the open event of this sap.ui.core.ws.WebSocket
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to call, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.ui.core.ws.WebSocket with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.base.EventProvider.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event close to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
oParameters | object |
Parameters to pass along with the event |
|
code | string |
Close code provided by the server |
|
reason | string |
Reason from server for closing the connection |
|
wasClean | string |
Indicates whether the connection was cleanly closed or not |
Fires event error to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
oParameters | object |
Parameters to pass along with the event |
Fires event message to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
oParameters | object |
Parameters to pass along with the event |
|
data | string |
Received data from the server |
Fires event open to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
oParameters | object |
Parameters to pass along with the event |