There is an issue when I pass Client.clientId in the Websync publish method, the clientId sometimes become all zero when catch by the OnReceive event from the client side.
May I know why sometimes the clientId value is successfully sent via the channel but most often the clientId value is somehow become all zero like 00000000-0000-0000-0000-000000000000.
Below is my code
Subscribe
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());
}
});
Publish
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]");
},
});