Ionic connect to signalR in remote web api


#1

i use web api to get information for ionic app.

i want connect to signalR to use notification.
i get error

my code is here


  $.connection.hub.url = localStorage.getItem('api-url') + 'signalr/hubs';

    $.connection.hub.start().done(function (data) {
        var notyHub = $.connection.notificationHub;
        console.log(notyHub);
        notyHub.client.notify = function (model) {
            console.log(model);
        };

        notyHub.client.console = function (text) {
            console.log(text);
        };
    });

hub is started but when i want call notify in server side get me error

webSocket connection to 'ws://localhost:35729/livereload' failed: WebSocket opening handshake timed out


#2

What is this? Where does it come from?[quote=“wildwolf2015, post:1, topic:96832”]
i want connect to signalR to use notification.
[/quote]

What does that mean?[quote=“wildwolf2015, post:1, topic:96832”]
localStorage
[/quote]

What is this? Where does it come from?

And as always: What is your ionic info output?


#3

$.connection.hub.url = 'http://localhost:8680/signalr/hubs';

this is for connect to web api signalr


#4

(You should update your CLI and app-scripts by the way… no harm)

You didn’t answer any of my questions yet. I don’t know where the object in code comes from, what Signalr actually is etc. You have to provide context to the code that is throwing an error.


#5

signalR like socket but for C# web api. in c# im using signalR to send real time notification for users.
in client side i connect to myhub (signalR hub name) and when server send notification for user show notification