NodeJS and socket.io ( Just Wondering )

It would be like with the routes, it will auto generate the listeners to listen to a specific message in some specific namespace and execute a flow when it receives the a message.

Here a sample, it is just an idea, there is no implementation at this moment. We would have some json that defines the endpoints like:

{
  "/chat": {
    "message": "incoming_message",
    "join": "join_room",
    "leave": "leave_room"
  }
}

This would generate code like:

io.of('/chat').on('connection', (socket) => {
  socket.on('message', runFlow('incoming_message'));
  socket.on('join', runFlow('join_room'));
  socket.on('leave', runFlow('leave_room'));
});

The flows are like you already know them in Wappler, they will have extra actions to emit messages, join/leave rooms etc.

On the client-side it would be the same, probably some app connect component that will be used to listen to messages and you then trigger flows to do something with the message and data you receive. We still have nothing created for this, so any input is welcome.

You can also write your own JavaScript code, but then you will be missing the integration with Wappler and with App/Server Connect.

3 Likes