Web Socket

WebSocket 的優點
和 HTTP 最大的差別是, WebScoket 在建立連線之後,可以實現 client 與 server 的雙向溝通機制,換言之,雙方可以即時的交換資訊,不用再等待 client 發出請求,或使用佔用資源的輪詢方式來實現。

WebSocket API

  • 取得 JWT Token (token only, refreshToken)
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"username":"tenant@thingsboard.org", "password":"********"}' 'https://demo.thingsboard.io/api/auth/login'
  • wss://demo.thingsboard.io/api/ws/plugins/telemetry?token=$JWT_TOKEN or
  • ws://192.168.1.110:8080/api/ws/plugins/telemetry?token=$JWT_TOKEN

h3 title 1

h3 title 2

h2 title b

References