WebSocketSession class
Abstraction of a websocket lifecycle
Constructors
-
WebSocketSession({FutureOr<
void> onOpen(WebSocketSession session)?, FutureOr<void> onMessage(WebSocketSession session, dynamic data)?, FutureOr<void> onClose(WebSocketSession session)?, FutureOr<void> onError(WebSocketSession session, dynamic error)?}) - Creates an instance of a web socket session. This instance needs to get return inside a ShelfPlus handler.
Properties
- channel ↔ WebSocketChannel
-
The original websocket channel created by package web_socket_channel
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onClose
↔ (FutureOr<
void> Function(WebSocketSession session)?) -
Invoked when web socket closes
getter/setter pair
-
onError
↔ (FutureOr<
void> Function(WebSocketSession session, dynamic error)?) -
Invoked web an error occurs
getter/setter pair
-
onMessage
↔ (FutureOr<
void> Function(WebSocketSession session, dynamic data)?) -
Invoked when web socket receives a message
getter/setter pair
-
onOpen
↔ (FutureOr<
void> Function(WebSocketSession session)?) -
Invoked when web socket session is opened
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sender → WebSocketSink
-
Returns reference to the websocket sink
no setter
Methods
-
close(
) → void -
Closes the connection.
To pass in a reason use
channel.sink.close()
. -
init(
WebSocketChannel webSocketChannel) → void - Initializer method called by webSocketHandler. You don't need to call this method manually.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
dynamic data) → void -
Sends a message with
data
to the other endpoint -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited