Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Are namespaces working now? #883

Unanswered
heatsink99 asked this question in Q&A
Discussion options

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?

You must be logged in to vote

Replies: 1 comment

Comment options

The event payload after receiving from the server will have a namespace inside it.
Ex:

  • Default namespace: ["event-name","hello"]
  • /time namespace: /time,["event-name","hello"]
    Could that be the reason for incorrect handling afterward?
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /