SignalR SignalR 1 Incredibly simple real-time web for ASP .NET Hub protocol 2 specs PS course Real-time applications using ASP.NET Core, SignalR & Angular 3 oct 16 & demo app 4 SignalR-plus-RX-Streaming-Data-Demo-App 5 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 6 Compare with protobuf, JSON, ZeroFormatter. Microsoft.AspNetCore.SignalR.Protocols.[Json|MessagePack|NewtonsoftJson]. MessagePackHubProtocol src 7 , proj 8 , DI extensions 9 , json hub protocol impl 10 configuration docs 11 . Under the Covers of ASP.NET Core SignalR article may 2018 12 The client side of a SignalR app needs a SignalR library @aspnet/signalr-protocol-msgpack Azure SignalR Service