TTMSFNCWebSocketClient compatibility with ASP.NET Core SignalR

Hello,

I’m working on a Delphi FMX mobile application (Android / iOS) and I already have a backend based on ASP.NET Core SignalR. I would like to use TTMSFNCWebSocketClient on the client side to connect to this existing SignalR server.

While researching this, I noticed that ASP.NET Core SignalR is not a plain WebSocket protocol. It includes:

  • an initial HTTP negotiate request,

  • a SignalR-specific handshake message,

  • message framing using a record separator (0x1E),

  • and a specific hub message format (JSON / MessagePack).

Given this setup, I’d like to ask:

  1. Is there a supported or recommended way to connect TTMSFNCWebSocketClient to an ASP.NET Core SignalR hub, either directly or by implementing the SignalR protocol on top of the WebSocket client?

  2. If direct SignalR compatibility is not supported, is TTMSFNCWebSocketClient intended to be used only specifically with TTMSFNCWebSocketServer, rather than with SignalR-based servers?

  3. In that case, do you have any recommendations or best practices for mobile FMX applications that need to communicate with SignalR-based backends?

I want to make sure I follow a correct and supported approach before proceeding further with the mobile client implementation.

Thank you for your time and guidance.

Best regards.

Hi,

TTMSFNCWebSocketClient is implementing the plain RFC6455 WebSocket protocol. If SingalR is doing something different then connection is not possible at this moment.

  1. Depends on how the SignalR protocol is defined. It might be possible to handle extra request in the beginning of the connection. If you have a link to the documentation they explain the connection, we can compare that to the TTMSFNCWebSocketClient implementation.
  2. Not just specifically with TTMSFNCWebSocketServer but with any WebSocket server that follows the RFC6455 specification.
  3. Unfortunately we don’t have experience with SignalR-based backends.

Hi,

Thank you for the clarification.

Official references:

Based on this specification, could you please confirm whether TTMSFNCWebSocketClient can technically handle the required handshake and message framing?

Hi,

Unfortunately TTMSFNCWebSocketClient won’t be able to handle this. WebSocket appears to be only a (transport) part of the SignalR client instead of being built completely on top of it. The SignalR C++ client library is using separate HTTP and WebSocket clients internally for example to handle the inital HTTP(S) communication.

The only way this could work is by implementing the SignalR protocol on your own and using TTMSFNCWebSocketClient for the WebSocket connection part. We came accross this writeup which gives some general idea on what needs to be done: SignalR on the Wire – an informal description of the SignalR protocol – Code, the Universe and Everything…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.