SignalR: Why choose Hub vs. Persistent Connection?

后端 未结 5 838
一个人的身影
一个人的身影 2020-12-04 09:20

I\'ve been searching and reading up on SignalR recently and, while I see a lot of explanation of what the difference is between Hubs and Persistent Connections I haven\'t be

5条回答
  •  粉色の甜心
    2020-12-04 09:49

    There are three major points to consider when comparing these two:

    • Message Format
    • Communication model
    • SignalR customization

    With hubs message formatting is basically handled from you but with persistent connections the message is raw and has be tokenized and parsed back and forth. If the message size is important then also note that the payload of a persistent connection is much less that that of a hub.

    When it comes to the communication model persistent connections basically have a function for sending and receiving messaging while hubs take a remote procedure call model with unique function per requirement.

    When it comes to customization since persistent connections are more low level they may give you more control over customization.

提交回复
热议问题