Support to SignalR


#1

Is there any way to implement SignalR in Nativescript?


#2

There is this plugin - https://github.com/NathanaelA/nativescript-signalr right now.


#3

Thanks Brad,

Do you know if is there any free plugin?


#4

Haven’t seen anything. Sorry.


#5

Guys,

SignalR just uses a bog standard web socket under the hood.

Manu Cohen-Yashar’s Blog
The above link shows signal r message specifics.

We have just written our own code fairly easily took ~1 day. We are using angular with nativescript.

Create an observable for the websocket.

  1. Call method to negotiate connection
    var url = http / https:// URL /signalr/negotiate?clientProtocol=1.5&connectionData=[encoded connection data] (this is the name of the hub connecting ie [{‘name’:‘hub_name’}]

http.get(‘url’…bla bla bla)

  1. Create web socket connection.
    url = ws / wss:// URL /signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken= &connectionData=
    var socket = new WebSocket(url);

  2. Add Listeners

  3. open your websocket