Pregunta

Does SignalR send the entire name of the callback method between the server and client every single time, or is there an encoding?

Example :

If I'm invoking a method named SetChatModeType on the server, it sends the entire method name the first time. But the next time I invoke it, the client and server both encoded the method name to fit in just a few bytes as opposed to sending the entire 'SetChatModeType'.

This is more of a curiosity than anything. I'm not invoking anything frequently enough for this to matter but it could be a deciding factor for me down the line.

¿Fue útil?

Solución

Yes it does appear to send that information from the Server to the Client, (parameter "M":"clientMethod" i.e. "M":"SetChatModeType"). This article dissects how the protocol works.

Example message format, explained in the article.

Client –> Server

{"H":"hubName", "M":"MethodName", "A":[arguments], "I":messageNumber }

Server –> Client

{"C":"B,6|O,0|P,0|Q,0", "M":[{"H":"hubName", "M":"clientMethod", "A":[arguments]}]}

The relevant response DTO, that triggers the client method is defined here.


As @PatrickFletcher points out, this article is a good resource for increasing SignalR performance and specifically addresses the issue of message size and how to reduce it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top