Connecting devices together!

Sock Idea

Organization

Sock is a idea, not a code. “Sock” allows you to connect to channels and communicate with other instances. Everyone can make his own “Sock” and “Sock Client”. Or you can use Lightweight Sock Server to host a Sock.


This content originally appeared on DEV Community and was authored by DEV Community

Sock Idea

Sock is a idea, not a code. "Sock" allows you to connect to channels and communicate with other instances. Everyone can make his own "Sock" and "Sock Client". Or you can use Lightweight Sock Server to host a Sock.

Why Websockets?

Simple, websocket is easy to use in browser. This allows you to host a "Sock" server and manage sock to communicate between back-end and front-end easily.

Why Not?

Not recommended for embedded devices. But still, Lightweight Sock Server only uses 2MB ram.

Making a Sock Server

To make a sock server, you must have these routes:

  • /channel/:channel (WebSocket): This route is where we connect our clients.
  • /api/channel/:channel/:id (HTTP): This route allows us to get a instance from channel
  • /api/channel/:channel (HTTP): This route allows us to get all instances from channel

And you must write-read a object that has:

  • type (int): Type for the instance. Every client has their own types.
  • data (string): This key can hold any data.
  • from (string): For see who sent the message.

If type is less than zero (0), Message is for pinging server to keep connection alive.

Please check Lightweight Sock Server to understand how it works.

Making a Sock Client

And you can make a sock client that allows anything... For example, you can make a sock client that allows to run a python code in channel and send output to other instances.

We made a client that uses "Sock" to send files and data between instances. Check it here

Please check Sockc to understand how it works.

Finishing

You can star project if you liked it!


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-03-11T18:36:30+00:00) Connecting devices together!. Retrieved from https://www.scien.cx/2022/03/11/connecting-devices-together/

MLA
" » Connecting devices together!." DEV Community | Sciencx - Friday March 11, 2022, https://www.scien.cx/2022/03/11/connecting-devices-together/
HARVARD
DEV Community | Sciencx Friday March 11, 2022 » Connecting devices together!., viewed ,<https://www.scien.cx/2022/03/11/connecting-devices-together/>
VANCOUVER
DEV Community | Sciencx - » Connecting devices together!. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/11/connecting-devices-together/
CHICAGO
" » Connecting devices together!." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/11/connecting-devices-together/
IEEE
" » Connecting devices together!." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/11/connecting-devices-together/. [Accessed: ]
rf:citation
» Connecting devices together! | DEV Community | Sciencx | https://www.scien.cx/2022/03/11/connecting-devices-together/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.