souvikcode Ответов: 0

Вызываю сигнальщика ASP.NET asmx webservice правильный процесс


I want to implement SignalR with asmx webservice. The service is called from my front end application and my project is running. My first question is, should I create SignalR hub here or I have to make another application for the Hub and use that for realtime purpose?

And second question is,

public class MyHub1: Hub
{
    public bool ConnectUser(long userId)
    {
        UserManipulation Up = new UserManipulation();//its my class to process user//
        return Up.ConnectUser(userId, Context.ConnectionId);
    }
}
This is hub method to save the connection Id in database with the userid.

Now in asmx page, you know we have to create a [webmethod], so that I can call that method from front end. I want to create a webmethod which will call this hub method.

[WebMethod]
public bool ConnectUser(string UserId)
{
        SignalRHub.MyHub1 myhub = new SignalRHub.MyHub1();//SignalRHub is namespace//
        return myhub.ConnectUser(UserId);
}
But the context within the hub method getting null.

I don't know I'm in right way or not, but please help me how can I achieve the things to implement Hub not directly in front end, instead this type of service.


Что я уже пробовал:

Я написал код, что я пытался и где я застрял.

0 Ответов