signalr

  • signalr Incredibly simple real-time web for ASP .NET
  • Hub protocol specs
  • PS course Real-time applications using ASP.NET Core, SignalR & Angular oct 16 & demo app
  • SignalR-plus-RX-Streaming-Data-Demo-App
  • SSE (server sent events) is a html5 feature. server response content type text/event-stream. js must instantiate an EventSource object. Easilt polyfilled for older browsers?
  • web sockets are a standardized way to use a TCP socket through which messages can be sent full duplex
  • lifetime of a web socket: http handshake, data exchange, close. all inside the same TCP socket.
  • web socket handshake
    • upgrade request. client sends random string
    GET /chat HTTP/1.1
    Host: server.chat.com
    Origin: client.chat.com
    Upgrade: websocket
    Connection: Upgrade
    Sec-WebSocket-Key: dfsddscxvb
    Sec-WebSocket-Protocol: chat, superchat
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Extensions: deflate-stream
    
    • 101 fine (switching protocols) response. Sends key back in accept header. Server add constant and hashes and base64 encodes.
    HTTP/1.1 101 Switching Protocols
    Upgrade: websocket
    Connection: Upgrade
    Sec-WebSocket-Accept: vcbvcbasdef
    Sec-WebSocket-Protocol: chat
    Sec-WebSockets-Extensions: deflate-stream
    
  • message is composed out of multiple frames with header bits to determine last frame. text msg converted to binary
  • realtime web apps: polling, long polling, sse and signalr. named transports, fallback mechanism integrated from most efficient to polling.
  • client side signalr libraries?
  • uses RPC for communication.
  • hub server side class that sends/receives messages to/from clients.
  • protocol is the serialization format: msgpack Compare with protobuf, JSON, ZeroFormatter. Microsoft.AspNetCore.SignalR.Protocols.[Json|MessagePack|NewtonsoftJson]. MessagePackHubProtocol src, proj, DI extensions, json hub protocol impl
  • configuration docs.
  • Under the Covers of ASP.NET Core SignalR article may 2018
  • The client side of a SignalR app needs a SignalR library @aspnet/signalr-protocol-msgpack
  • Azure SignalR Service