Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created April 2, 2011 05:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/899244 to your computer and use it in GitHub Desktop.
Save aaronpk/899244 to your computer and use it in GitHub Desktop.
Sending location data to the Geoloqi streaming server
require 'rubygems'
require 'socket'
socket = TCPSocket.new("stream.geoloqi.com", 40000)
puts socket.recv(100)
socket.write('your-access-token')
socket.flush
# The server outputs a confirmation message after connecting
puts socket.recv(1000)
# This will contain the message payload if you send a message to yourself with the http://geoloqi.org/API/message/device method
puts socket.recv(1000)
# An example of sending location data via the socket
# Date Latitude Longitude Speed Accuracy Battery
socket.send('A' + "\x4D\x95\x5D\x80" + "\x00\x87"+"\x00\x07\xCF\x38" + "\x00\x3A"+"\x00\x09\xD0\xE4" + "\x00\x14" + "\x00\x15" + "\x00\x14", 0)
puts socket.recv(100)
socket.send('A' + "\x4D\x95\x5D\x80" + "\x00\x87"+"\x00\x07\xCF\x38" + "\x00\x3A"+"\x00\x09\xD0\xE4" + "\x00\x14" + "\x00\x15" + "\x00\x14", 0)
puts socket.recv(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment