Skip to content

kimhono97/oh_socket

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Getting Started

Run the server

  • Install Node.js (v20.12.2 recomanded)
# Check if Node.js is installed
$ node -v
v20.12.2
  • Install Node.js libraries
$ cd <repo-dir>
$ npm i
  • Run
$ npm run build
$ npm run start

Open test web pages

Open http://localhost:3000 with your browser to see the test pages (sender or receiver).

Sender : Send the number data into a room

Request the following HTTP GET/POST to the server (:3000)

GET http://localhost:3000/api/sendNumber?room=myRoomName&data=7

or

POST http://localhost:3000/api/sendNumber
Content-Type: application/json

{
    "room": "myRoomName",
    "data": 7
}

Receiver : Join a room

  • Connect to ws://localhost:3001

  • Send the following JSON text

{
    "type": "moveToRoom",
    "roomId": "<room-name-to-join>"
}
  • Listen the following JSON text
{
    "type": "numData",
    "data": 7 
}

Receiver Example ESP32

See esp32/ESP-IDF/README.md or esp32/PlatformIO/README.md

Learn More Next.js

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

About

Command via Socket

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors