Oyatel / CometD.NET

CometD.NET is a C# client library for the Bayeux protocol
44 stars 34 forks source link

message.clientId is null ??? #13

Open MrGibbage opened 12 years ago

MrGibbage commented 12 years ago

Using the example code, the message received (IMessage), which has a clientId parameter, is always null. Should this not be containing the client ID of the sender? Thus, it should never be null??

public class Listener : IMessageListener { //private BayeuxClient client; public void onMessage(IClientSessionChannel channel, IMessage message) { IDictionary<String, object> ss = (IDictionary<String, object>)message.DataAsDictionary; String foo = (String)ss["foo"]; String senderClientId = message.ClientId; // is always null if (senderClientId.Equals(Form1.clientId)) //should crash here { MessageBox.Show("I sent a message to myself"); } else { MessageBox.Show(ss["foo"].ToString()); } } }

grEvenX commented 12 years ago

ClientID can be null, it depends on the situation.

See http://svn.cometd.com/trunk/bayeux/bayeux.html at the following sections: 3.1 and 4.1.2. In order to understand why it's null in your case I would have to see more code.

MrGibbage commented 12 years ago

It's basically the same code as yesterday.

https://gist.github.com/1620693

I only see one method for publishing, and neither one of them have anything to do with sending/not sending a clientId.