DefaultWebSocketListener class
Default WebSocketListener implementation to ease listener use
- Implemented types
Constructors
- DefaultWebSocketListener(dynamic _onWsOpen(WebSocketConnection), dynamic _onWsClosed(int, String), [dynamic _onStringMessage(String) = _voidOnStringMessage, dynamic _onByteMessage(Uint8List) = _voidOnByteMessage, dynamic _onWsClosing(int, String) = _voidOnWsClosing, dynamic _onError(Exception) = _voidOnError])
- Default constructor
- DefaultWebSocketListener.forByteMessages(dynamic _onWsOpen(WebSocketConnection), dynamic _onWsClosed(int, String), dynamic _onByteMessage(Uint8List), [dynamic _onWsClosing(int, String) = _voidOnWsClosing, dynamic _onError(Exception) = _voidOnError])
- Helper constructor for Byte messages web-socket connection only
- DefaultWebSocketListener.forTextMessages(dynamic _onWsOpen(WebSocketConnection), dynamic _onWsClosed(int, String), dynamic _onStringMessage(String), [dynamic _onWsClosing(int, String) = _voidOnWsClosing, dynamic _onError(Exception) = _voidOnError])
- Helper constructor for Text messages web-socket connection only
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onByteArrayMessage(
Uint8List message) → void -
Invoked when a binary (type
0x2
) message has been received.override -
onError(
Exception exception) → void -
Invoked when error occurs in transport between dart and platform.
override
-
onStringMessage(
String message) → void -
Invoked when a text (type
0x1
) message has been received.override -
onWsClosed(
int code, String reason) → void -
Invoked when both peers have indicated that no more messages will be transmitted and the
connection has been successfully released. No further send/receive calls is possible.
All resources like WebSocketConnection should be released after this.
override
-
onWsClosing(
int code, String reason) → void -
Invoked when the remote peer has indicated that no more incoming messages will be transmitted.
All resources like WebSocketConnection should be released after this.
override
-
onWsOpened(
WebSocketConnection webSocketConnection) → void -
Invoked when a web socket has been accepted by the remote peer and may begin transmitting
messages. Only after this method is invoked, client is able to send/receive ws messages.
Returned WebSocketConnection can be used to send text/byte messages to server as long
as connection is still active (unless onWsClosing or onWsClosed are called)
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited