socket.io-client-dart
socket.io-client-dart copied to clipboard
Socket client creating Multiple Connections to all backend servers
Below is the code for instantiating the socket. in my backend anytime a client connects I store the socketId as well as remove it when it disconnects. When I deploy the app on a physical device, it creates more than one WS connection.
var namespace = "ns/rtm/socket";
var url = "$_basePath/gw/service/$namespace";
var path = "/gw/notifications-service/socket.io";
var accessToken = await _storageService.getAuthToken();
_socket = io(
url,
OptionBuilder()
.setTransports(["websocket"])
.disableAutoConnect()
.enableReconnection()
.setPath(path)
.setQuery({"accessToken": accessToken})
.build());
_socket.nsp = "/$namespace";
_socket.connect();
How do I prevent this behavior
any update?
Some problem, any idea how to solve it?