- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我在 Websync publish 中传递 Client.clientId 时出现问题方法中,当被 OnReceive 捕获时,clientId 有时会变成全零。来自客户端的事件。
我可以知道为什么有时 clientId 值会通过 channel 成功发送,但大多数情况下 clientId 值会以某种方式变为全零,例如 00000000-0000-0000-0000-000000000000。
下面是我的代码
订阅
var client = new fm.websync.client('http://localhost:12345/websync');
client.connect
({
onSuccess: function (e) {
$('#connectionStat').val('Successfully connected');
},
onFailure: function (e) {
$('#connectionStat').val('Failed to be connected');
},
onStreamFailure: function (e) {
$('#connectionStat').val('Failed to be connected on stream');
}
});
client.subscribe({
channel: '/testService/clientId',
onSuccess: function (e) {
},
onFailure: function (e) {
},
onReceive: function (e) {
alert(e.getData());
}
});
发布
Client client = new Client("http://localhost:12345/websync");
client.Connect(new ConnectArgs
{
OnSuccess = (e) =>
{
Debug.WriteLine("Successfully connected [OnSuccess]");
},
OnFailure = (e) =>
{
Debug.WriteLine("Failed in connected [OnFailure]");
},
OnComplete = (e) =>
{
Debug.WriteLine("Successfully connected [OnComplete]");
},
OnStreamFailure = (e) =>
{
Debug.WriteLine("Failed connected [OnStreamFailure]");
}
});
client.Publish(new PublishArgs("/testService/clientId", Json.Serialize(client.ClientId))
{
OnSuccess = (e) =>
{
Debug.WriteLine("Successfully published client id [OnSuccess] = " + client.ClientId.ToString());
},
OnComplete = (e) =>
{
Debug.WriteLine("Successfully published [OnComplete]");
},
OnFailure = (e) =>
{
Debug.WriteLine("Failed to publish [OnFailure]");
},
});
最佳答案
等待发布
,直到连接
成功完成。客户端的 ID 由服务器生成,当调用 Publish
时,Connect
操作可能尚未完成。
最简单的方法是将 Publish
调用移至 Connect
的 OnSuccess
回调中。
关于javascript - WebSync Publish ClientId 变为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48438036/
我按需获得了一个 websync 服务器,并在 www.hariwebsync.com 注册了一个域并获得了 api key 。在我的 javascript 客户端中,我写了 fm.websync
当我在 Websync publish 中传递 Client.clientId 时出现问题方法中,当被 OnReceive 捕获时,clientId 有时会变成全零。来自客户端的事件。 我可以知道为什
我正在使用 IceLink 库进行点对点通信。我们需要为此部署两台服务器 IceLink 和 WebSync,如下所示 http://docs.frozenmountain.com/icelink2/
我已经在 Azure 应用程序服务上部署了 .net 应用程序,当我通过自定义域或应用程序服务默认域访问它时,它工作得很好,包括 webSync 连接,但只有当我启用 Azure 前门和点时,WebS
我们一直在使用以下技术实现网站。 客户端: Html5、KendoUI、WebSync(发布、订阅) 服务器: ASP.net MVC 3.0 网格对每一行都有特定的操作。例如,我们需要在选中特定行的
我是一名优秀的程序员,十分优秀!