GoSpyGo

Connecting with your robot instantly and effortlessly

PLEASE CONNECT...

(sometimes)
It is painful
to configure

Wi-Fi :on

(auto) shell
​script to run python

Raspberry Pi

GoSpyGo

#fetch-data

FETCH

READING

NOW!

YOU
GET
READINGS!

STACK

#app/middleware/websocket_backend.rb
class WebsocketBackend
  KEEPALIVE_TIME = 15 # in seconds

  def initialize(app)
    @app     = app
    @clients = []
  end

  def call(env)
    if Faye::WebSocket.websocket?(env)
      ws = Faye::WebSocket.new(env, nil, {ping: KEEPALIVE_TIME })

      ws.on :open do |event|
        p [:open, ws.object_id]
        @clients << ws
      end

      ws.on :message do |event|
        p [:message, event.data]
        @clients.each {|client| client.send(event.data)}
      end

      ws.on :close do |event|
        p [:close, ws.object_id, event.code, event.reason]
        @clients.delete(ws)
        ws = nil
      end

      ws.rack_response

    else
      @app.call(env)
    end
  end
end

THE JOY

DEMO

GoSpyGo-presentation

By Frances Ng

GoSpyGo-presentation

  • 532