【发布时间】:2018-04-21 07:33:27
【问题描述】:
我正在尝试在 .done 范围内开始连接到 signlar 服务器(使用 start())后获取我的连接 ID 值。但不幸的是,我一直没有为它定义。 希望各位大神帮忙看看是什么问题。 谢谢!
public startConnection(): void
{
this.connection = $.hubConnection('http://localhost:62752');
this.proxy = this.connection.createHubProxy('ChatHub');
this.proxy.on('messageReceived', (a,b,c,d,e,f) =>
this.onMessageReceived(a,b,c,d,e,f));
this.connection.start().done((data: any) => {
console.log('Connected to Chat Hub');
this.connectionID = $.connection.hub.id;
console.log($.connection.hub.id);//undefined
this.registerConnection();
});
}
【问题讨论】:
标签: javascript angular typescript signalr signalr-hub