Hi, I have found out the reason why this one is occurring,
Instead of, sending the channel key I have send the token itself to the sendMessage function. May be you might have done the same.This will be the confusing terms in the beginning. you check whether you are sending the channel key or the token On Sun, Jul 3, 2011 at 4:58 AM, Sonny <[email protected]> wrote: > I'm having the same issue here ... I can verify in chrome dev tools > that I am using the correct tokens, but I am getting the following > error in Eclipse: > > [WARN] Skipping message to unconnected channel: <...token...> > > On Jun 22, 5:58 pm, Saranya Kannan <[email protected]> wrote: > > Hi All, > > > > I have implemented sample chat application using ChannelAPI. > > > > I have created the channel, and the I can see the channel got > > connected in the firebug > > > > I am passing the same channelkey to the sendMessage function. > > > > But it is not sending the msg back to the client.. > > It saysSkippingMessage to unconnected channel > > > > Here is the code I have written on the server side: > > > > For creating the token: > > > > String key = "tokenchat"; > > ChannelService channelService = > > ChannelServiceFactory.getChannelService(); > > String token = channelService.createChannel(key); > > > > Here is the code for sendMessage: > > > > ChannelService channelService = > > ChannelServiceFactory.getChannelService(); > > ChannelMessage lMessage= new > > ChannelMessage(channelKey.trim(), "Test Message"); > > channelService.sendMessage(lMessage); > > > > And here is my javascript code: > > > > var connected = false; > > > > sendMessage = function(path, opt_param) { > > console.info('The channel key is ::'+channelKey); > > //path='http://localhost:8888/channelMessage.do'; > > path += '?channelKey=' + channelKey; > > if (opt_param) { > > path += '&' + opt_param; > > } > > var xhr = new XMLHttpRequest(); > > xhr.open('POST', path, true); > > xhr.send();}; > > > > onOpened = function() { > > connected = true; > > console.info("Inside open function"); > > > > }; > > > > onMessage = function(msg) { > > alert('IN SOCKETs ONMESSAGE FUNCTION'); > > var data = $.parseJSON(msg.data); > > console.debug("content: " + data.content); > > > > }; > > > > onError = function() { > > > > }; > > > > onClose = function() { > > socket.close(); > > > > }; > > > > function channelopen(channeltoken) > > { > > console.info('channel token is ::'+channeltoken); > > channel = new goog.appengine.Channel(channeltoken); > > socket = channel.open(); > > socket.onopen = onOpened; > > // socket.connect(channel); > > socket.onmessage = onMessage; > > socket.onerror = onError; > > socket.onclose = onClose; > > > > > > > > > > > > > > > > } > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- * Thanks, Saranya.S * -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
