-
Notifications
You must be signed in to change notification settings - Fork 575
Are namespaces working now? #883
-
I'm using this library on a Pi Pico W (Arduino IDE / C++) to connect using socketIO to a Node.js Socket.IO server.
This is working well when I connect to the root namespace. The Pico connects, and I can emit messages which I receive on the server end.
However if I connect to a different namespace, the socket disconnects and reconnects when the Pico tries to send.
i.e. when I have:
void socketIOEvent(socketIOmessageType_t type, uint8_t * payload, size_t length) {
...
case sIOtype_CONNECT:
sprintf(tmps, "[IO] Connected to url: %s", payload);
dbg(fDebug, tmps);
// join default namespace (no auto join in Socket.IO V3)
socketIO.send(sIOtype_CONNECT, "/");
smsg(SMSG_SCNCT);
break;
...
I can emit messages to the server.
But if I change the namespace from "/" to "/timer"
i.e.
void socketIOEvent(socketIOmessageType_t type, uint8_t * payload, size_t length) {
...
case sIOtype_CONNECT:
sprintf(tmps, "[IO] Connected to url: %s", payload);
dbg(fDebug, tmps);
// join default namespace (no auto join in Socket.IO V3)
socketIO.send(sIOtype_CONNECT, "/timer");
smsg(SMSG_SCNCT);
break;
...
I can successfully connect to the /timer namespace. From the Node.JS end I can see the socket connect. However as soon as the Pico emits a message, the socket disconnects (Socket.IO in Node,js reports error reason "force close"), and the Pico then connects again.
It is possible to use namespaces other than root with a Pi Pico W? The last comment in issue #620 (back in 2021) suggested the namespace is not being saved?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
The event payload after receiving from the server will have a namespace inside it.
Ex:
- Default namespace:
["event-name","hello"] /timenamespace:/time,["event-name","hello"]
Could that be the reason for incorrect handling afterward?
Beta Was this translation helpful? Give feedback.