0

My requirement is to communicate socketio with nodejs server to Raspberry Pi running a local Python app. Please help me. I can find ways of communication with web app on google but is there any way to communicate with Python local app with above mentioned requirements.

1 Answer 1

1

It's unclear exactly which part you need help with. To make a socket.io connection work, you do the following:

  1. Run a socket.io server on one of your two computers. Make sure it is listening on a known port (it can share a port with a web server if desired).

  2. On the other computer, get a socket.io client library and use that to make a socket.io connection to the other computer.

  3. Register message handlers on both computers for whatever custom messages you intend to send each way and write the code to process those incoming messages.

  4. Write the code to send messages to the other computer at the appropriate time.

Socket.io client and server libraries exist for both node.js and python so you can either type of library for either type of system.

The important things to understand are that you must have a socket.io server up and running. The other endpoint then must connect to that server. Once the connection is up and running, you can then send message from either end to the other end.

For example, you could set up a socket.io server on node.js. Then, use a socket.io client library for python to make a socket.io connection to the node.js server. Then, once the connection is up and running, you are free to send messages from either end to the other and, if you have, message handlers listening for those specific messages, they will be received by the other end.

Sign up to request clarification or add additional context in comments.

2 Comments

That almost answered my question. I found a link of source code on github. I'll mark your answer as accepted and post that link here, if that does the trick.
I have found a client library of Python link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.