I have a 3G+GPS device (Digi WR44) that can send NMEA packets to any IP address.
I would like to get this data from a Rails (or Sinatra) application, but the packets are not send as a valid HTTP request and both Rails and Sinatra fails.
Here is the Rails error : ERROR bad Request-Line
And the Sinatra error : !! Invalid request
It seems that I cannot configure the device to send valid HTTP requests instead of the plain content, do you know if there is a way to handle an HTTP re开发者_开发知识库quest composed of plain text ?
I tried with a PHP script, the NMEA packet was interpreted as the request_method, but I would like to use ruby in this project (with Model access).
Thanks a lot for your help :)
PS : I'm running the last versions of Ruby, RoR and Sinatra
I finally found a solution, which is to create a ruby script listening to a given port with the Socket library. Trivial but useful examples are available here : http://www.tutorialspoint.com/ruby/ruby_socket_programming.htm
It is also easy to access activerecord inside a non-rails ruby script : http://blog.aizatto.com/2007/05/21/activerecord-without-rails/
精彩评论