dox_websocket 1.0.0-beta.1 dox_websocket: ^1.0.0-beta.1 copied to clipboard
Websocket library for dox framework.
Dox Websocket #
Websocket library for dox framework.
Features #
- Support redis driver
Usage #
- Create a service
class WebsocketService implements DoxService {
@override
setup() {
DoxWebsocket websocket = DoxWebsocket();
Redis sub = Redis();
Redis pub = sub.duplicate();
websocket.adapter(
WebsocketRedisAdapter(subscriber: sub, publisher: pub),
);
Dox().setWebsocket(websocket);
}
}
- Register in dox
Dox().initialize(config);
Dox().addService(WebsocketService());
await Dox().startServer();
Note #
- If you are not using redis adapter, websocket do not support with multiple isolate. You will need to set to single isolate.
Dox().totalIsolate(1);