Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Just wondering how exactly the client will receive the event from the socket.io server. #44

Closed

Description

@PrinceSalmon

Hey Khoi!

Cheers for helping me earlier, I got it working now, seemed to be an issue with how I portfowarded of sorts. Not really an issue here just need clarification. I am quite new to arduino and this might seem obvious, but im having a bit of a hard time understanding how exactly.

Say my server is emitting the event.

io.emit("Event", ("Hello World!"))

Which one of the arguments should I use to get it to print out the event? From what I've seen you need the call the event before you declare it on the ESP32 side, this got my bewildered as a normal client on socket.io doesnt declare the event before it happens. In the documentation I saw these two referred:

void (*WebSocketClientEvent)(WStype_t type, uint8_t * payload, size_t length)

And

void onEvent(WebSocketClientEvent cbEvent);

Callback is the data of the event right? Which one of these two would you use for it to detect the event named "Event" and for it to print the "Hello World!" string, and how does the client know which event to respond to. On sockets.io when you program a client tradionally you simply just use the socket.io function

Cheers and thanks in advance, I'm sorry is this is a stupidly obvious question.

Activity

  1. Repository owner locked and limited conversation to collaborators on Dec 20, 2022
  2. converted this issue into a discussion #45 on Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions