1

I've read here about the structure of signalR's response message :

for example

  • For PersistentConnection

    {"C":"B,2CE|K,C|L,2|M,0|I,0|J,0","M":["foo"]}

Where

Persistent Response:
C - cursor
M - Messages
T - Timeout (only if true) value is 1
D - Disconnect (only if true) value is 1
R - All Groups (Client groups should be reset to match this list exactly)
G - Groups added
g - Groups removed

Question #1

What's wrong with sending only the message part ? why do i need all the "C" information ? The client only needs the message. A message number #N is not dependent with message number #N-1 (AFAIK) -- so I dont see the reason for this "C" section. ( and I assume Im wrong by missing something here).

Question #2

Even so , how can I understand what the tokens means ? I didn't see in the manual the "K,L,I,J,2CE" tokens.

Where / How can I understand what they are saying ? What if I don't want the server to send that info but only the message ?

4

1 回答 1

6

开源有一个经常被忽视的特性。您可以简单地下载源代码并环顾四周。通过简单地在源中搜索字符串“R”,我能够找到您正在寻找的一些信息。

Answer #2: 这些速记属性名称直接映射到 SignalR 中对象的 JsonSerialization。集线器响应

  • S - 状态
  • R - 结果
  • 我 - 身份证
  • E - 错误
  • T - 堆栈跟踪

持久反应

  • L - LongPollDelay
  • D - 断开连接
  • T - 超时
  • G - GroupsToken

在当前的代码库中找不到其他一些,并且由于您提到的问题是 7 个月大,我猜它们已经被重构了。

Answer #1: 元数据对于 SignalR 的运行方式很重要。框架的双刃剑是我们将领域或它解决的问题转移给框架及其创建者,我们默许他们成为领域专家。有时,如果您想查看这些属性中的每一个实际用于下载源代码并按照代码进行操作,那么使用起来有点像黑匣子。如果出于某种性能原因,您觉得有必要围绕您确定为无关的部分删减一些代码,请分叉代码并试一试。

于 2013-05-18T17:30:45.490 回答