connecting to realtime streaming server with socket.io on iOS
  • I can successfully connect to 
    subscribe.geoloqi.com:443

    The first 'event' I receive is {"name":"enter authentication"}

    I have tried to send messages/events back in all kinds of combinations, but have yet to find the magic touch

    'token', 'trip-TQ4ew3Z'

    {"token":"trip-TQ4ew3Z"}

    No matter what I send I can't seem to get a response.  What I would expect is that after I send the token/trip I would start receiving location updates for the trip.  Is that correct?










  • 3 Comments sorted by
  • I am not super familiar with the socket.io iOS library, but you can check out the Javascript source code that we use on the website here: https://github.com/geoloqi/geoloqi-js/blob/master/source/geoloqi-sockets.js#L24

    What you need to do is send an event of type "token" with a value of "trip-XXXXXXX" or "group-XXXXXXX". At that point, you should start receiving "location" events. I believe you need to first set up a listener for events of type "location" before you receive them. 
  • got it working...
    emit sends an event along with data, but the socket.io framework only let me send a dictionary of values along with the event. 
    The author of the socket.io ios library I was using pointed me to a fork that sends data with the event (in this case the NSString @"trip-xxxx")
    https://github.com/TheFuzzball/socket.IO-objc  if ([eventType isEqualToString:@"enter authentication"]) {
    [socketIO sendEvent:@"token" withData:@"trip-TQ4ew3Z"];
        }

    Onto my next question...I can get real time location updates for groups & trips found in this link (http://stream.geoloqi.com:40003/group/gXnvkgTXn), but can't get data for groups I create myself.
    Here's an example group I created: 2zbTheQgh
    http://stream.geoloqi.com:40003/group/2zbTheQgh
    Any idea why my location updates aren't getting sent to the server?  I guess better question - how do I get my location updates to the real time streaming server...I know I can pull location updates once they're there, but I don't seem to have access to update location there.


  • It could be that your users are not joined to the group? Make sure you've run the group/join/:token method for the users you want to show up in the group's stream. 

    The link you found is the experimental streaming HTTP service, which is not the same as the socket.io service. You should be able to connect to the group channel on socket.io by sending a "group-XXXXX" message of the type "token" when you first connect.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion