golang chat app using telnet (TCP)
Create a file in the same directory as the telchat application called config.yml with all desired configuration properties. For an example see config.yml.example.
- Compile the application for your desired architecture and platform:
GOOS=<OS> # optional
GOARCH=<Arch> # optional
go build
- Run the application:
./telchat
Connect a client to the TCP chat server by running:
telnet <TCPAddress> <TCPPort>
You can send messages via HTTP into the chat server using an HTTP POST to http://:/message with a JSON payload matching the following format:
{
"sender":"my name",
"message":"my message"
}
Here is an example of how to send a message using curl:
curl -X POST http://localhost:8080/message -d "{\"sender\":\"curler\",\"message\":\"hi\"}"