Skip to content

vadim-gleif/simple-tcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published