Skip to content

4rgon4ut/ws-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fiber based websocket nonblocking echo-chat server.

(with JSON-RPC example)

 

Download

  git clone [email protected]:bestpilotingalaxy/ws-chat.git
  
  cd ws-chat

 

Starting server

*change .env if necessary

    docker build  -t ws-chat-server .
    
    
    docker run  --network host  --env-file=.env  ws-chat-server:latest

 

Starting client

    docker run  --network host --env-file=.env  -it --entrypoint  /bin/bash  solsson/websocat

- Text messages

From container shell:

    websocat ws://0.0.0.0:$SERVER_PORT/ws

- JRPC calls

     websocat --jsonrpc -b ws://0.0.0.0:$SERVER_PORT/ws

message format:

     BroadcastToAll "hello"

(now only BroadcastToAll method supported)

 

Structure

image

 

Debug

I'm personally use VSCode with dlv-dap debugger

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "debugAdapter": "dlv-dap",
            "trace": "verbose",
            "program": "${workspaceFolder}/cmd/server/",
            "envFile": "${workspaceFolder}/.env"
        }
    ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published