websocket_universal library

Convenient websocket handler for all platforms (both IO and web/HTML). Websocket messages routing, statuses and other features have easy-to-use interface.

Classes

BaseDecode
Base decoder helper
CompositeSocketResponse
Composite server response implemntation
CustomGameModel
Object for demonstration purposes
ICompositeSocketResponse
Composite response that is result of ISocketRequest with multiple responseTopics
IMessageProcessor<Tin, Yout>
Websocket processor interface for Tin-typed input messages from server and Yout-typed outgoing messages to server
IMessageToServer
Convenient interface to send message to server
IPlatformWebsocket
Universal platform websocket implementation
ISocketLogEvent
Common log event interface for websocket Listen to it in order to understand what is happening inside websocket
ISocketManagerMiddleware
Middleware between socket handler and manager
ISocketMessage<T>
Convenient interface for websocket messaging between server and client
ISocketRequest
WebSocket request to server that expects a collection of answers from server in timeoutMs interval
ISocketResponse
Grouped reponse data to ISocketRequest
ISocketState
Interface for websocket current state data
ISocketTopic
Object interface to route websocket message data. Used same way as URL/URI in simple HTTP requests
ITimedSocketResponse<T>
ISocketMessage with timestamp
IWebSocketBaseService<Tin, Yout>
Basic universal (multiplatform) websocket service. Tin is type of incoming deserialized messages (that are received from server and deserialized) Yout is type of outgoing messages (that will be sent to server by you)
IWebSocketDataBridge
Interface between ISocketRequest and getting actual data from server
IWebSocketHandler<Tin, Yout>
Basic websocket handler. Tin is type of incoming deserialized messages (that are received from server and deserialized) Yout is type of outgoing messages (that will be sent to server by you)
IWebSocketRequestManager
asyncSocket.requestData(socketTopic)
MessageToServer
Convenient message model to send message to server
SocketConnectionOptions
WebSocketHandler behaviour options
SocketLogEventImpl
Common log event implementation for websocket
SocketManagerMiddleware
Middleware implementation between socket handler and manager
SocketMessageImpl
Convenient message model for websocket message
SocketMessageProcessor
IMessageProcessor for ISocketMessage-typed input messages from server and IMessageToServer-typed outgoing messages to server
SocketOptionalParams
Optional parameters for the webSocket connection
SocketRequest
WebSocket request to server
SocketSimpleBytesProcessor
IMessageProcessor that sends to and receives 'List
SocketSimpleTextProcessor
IMessageProcessor that sends to and receives simple String text from Server
SocketStateImpl
Websocket current state data implementation
SocketTopicImpl
ISocketTopic implementation to route websocket message data. Used same way as URL/URI in simple HTTP requests
TestDecoder
Test message decoder
TimedMessage<T>
ITimedSocketResponse implementation with timestamp
TimeoutSocketRequest
Request with time stored
WebSocketBaseService<T, Y>
Base implementation of IWebSocketBaseService using IPlatformWebsocket abstraction
WebSocketDataBridge
Data bridge between sending ISocketRequest and getting useful data from websocket
WebSocketRequestManager
Handles websocket request on logic level using ISocketMessage intraface. Times websocket requests.

Enums

SocketLogEventType
Event types for common events, happening in websockets
SocketStatus
Websocket connection status

Extensions

IEnumerableExtension on Iterable<T>
Inner extension

Constants

topicJsonKey → const String
Json key for topic property

Functions

createWebsocketBaseService<T, Y>(String connectUrlBase, IMessageProcessor<T, Y> messageProcessor, {int timeoutConnectionMs = 5000, int pingIntervalMs = 2000, bool skipPingMessages = true, bool pingRestrictionForce = false, IPlatformWebsocket? platformWebsocket}) IWebSocketBaseService<T, Y>
Websocket base service factory
socketTopicFromJson(String fullPath) ISocketTopic
Deserialize ISocketTopic from JSON. From server expected String of the following format: 'host/topic1/topic2/topic3' (without quotes) Example of usage with 'json_annotation' package: @JsonKey(fromJson: socketTopicFromJson, toJson: socketTopicToJson) final ISocketTopic topic;
socketTopicToJson(ISocketTopic socketTopic) String
Serialize ISocketTopic to JSON string. Server will receive serialized topic of the following format: 'host/topic1/topic2/topic3' (without quotes) Example of usage with 'json_annotation' package: @JsonKey(fromJson: socketTopicFromJson, toJson: socketTopicToJson) final ISocketTopic topic;