[英]Moving SignalR object between HTML pages
I use SignalR
on JavaScript
. 我在JavaScript
上使用SignalR
。
I have two objects: an Connection
object and an Hub Proxy
object: 我有两个对象: Connection
对象和Hub Proxy
对象:
var connection = $.hubConnection();
connection.url = 'http://localhost:xxx/signalr';
var contosoChatHubProxy = connection.createHubProxy('ChatHub');
I want these two objects to be recognized in some HTML
pages, I tried to put them in SessionStorage
so I had to convert them to JSON: 我希望在某些HTML
页面中识别这两个对象,我试图将它们放在SessionStorage
因此不得不将它们转换为JSON:
sessionStorage["connection"]= JSON.stringify(connection);
sessionStorage["proxyHub"]= JSON.stringify(contosoChatHubProxy);
I got the following error: 我收到以下错误:
"Converting circular structure to JSON"
I found about this information in several places, and everywhere was written that should determine the real object . 我在几个地方找到了有关该信息的信息,到处都写有确定真实对象的信息 。
The question is what is the real object? 问题是什么才是真正的对象?
Below there is a picture of the connection object from Console: 下面是控制台的连接对象的图片:
Or is there another way to pass object between pages without converting it? 还是有另一种方法可以在页面之间传递对象而不进行转换? (without cookies) (不含Cookie)
A new page requires a new connection. 新页面需要新的连接。 Would love to be proven wrong. 很想被证明是错误的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.