Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 888 Bytes

README.md

File metadata and controls

39 lines (30 loc) · 888 Bytes

simple-tcp-server

Test

What is it

TCP service in Go.

Allow connecting by TCP. It notifies user's friends about his status changing (online or not).

How to connect by TCP:

telnet localhost 8080

Send a json payload:

{"user_id": 1, "friends": [2, 3, 4]}

It will be stored in-memory.

When another connection is established with the user_id from the list of any other user's friends section, they will be notified about it with message:

{"friend_id": 1, "online": true}

When the user goes offline, their friends (if they have some and any of them are online) will receive a message:

{"friend_id": 1, "online": false}

Build:

docker build -t simple-tcp-server . 

Run:

 docker run -it -p=8080:8080 simple-tcp-server