Skip to content

feuyeux/hello-websocket

Repository files navigation

Hello Websocket

☕ Protocol

Upstream

REQEUST

{
  "id": 1,
  "data": "请求数据",
  "meta": "客户端语言"
}

RESPONSE

{
  "status": 200,
  "results": [
    {
      "id": 1234567890,
      "type": "OK",
      "kv": {
        "id": "uuid",
        "idx": "1",
        "data": "响应数据",
        "meta": "服务器端语言"
      }
    },
  ]
}

Downstream

REQEUST

{
    "os_name": "Windows",
    "os_version": "10.0.19042",
    "os_release": "10",
    "os_architecture": "AMD64"
}

RESPONSE

{
    "language": "en_US",
    "encoding": "UTF-8",
    "time_zone": "UTC"
}

☕ Diagram

%%{
  init: {
    'theme': 'forest'
  }
}%%
sequenceDiagram        
	Hello Client->>+Hello Server:connect
	Hello Server->>Hello Server:session[+client]
	Hello Server->>-Hello Client:connected
	Hello Client->>+Hello Server:EchoRequest
	Hello Server->>-Hello Client:EchoResponse
	
    loop Every 10 seconds
    	participant Hello Server
    	participant Hello Client
        Hello Server->>+Hello Client:ping
        alt pong
            Hello Client->>-Hello Server:pong
        else timeout
            Hello Server->>Hello Server:session[-client] & close
        end      
    end
    
    loop Every 5 seconds
        Hello Server->>+Hello Client:KissRequest
        Hello Client->>-Hello Server:KissResponse
    end
    
    Hello Client->>+Hello Server:disconnect
	Hello Server->>-Hello Server:session[-client] & close
Loading

☕ Features

  • protocol send/receive
  • header
  • ping/pong
  • handshake
  • tls

☕ Langues

  1. hello-websocket-java
  2. hello-websocket-go
  3. hello-websocket-rust
  4. hello-websocket-python
  5. hello-websocket-nodejs

☕ Build & Ship

☕ Recommend

https://github.com/facundofarias/awesome-websockets

☕ Stars

Star History Chart

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published