Skip to content

IoTtalk/CameraWithLineUp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CameraWithLineUp

This is a sample for line up module base on Flask server.

Server

install (shell)

install python package gevent-websocket

pip install gevent-websocket

or use requirements.txt

pip install -r requirements.txt

usage (python)

import the lineup.py module

import lineup

add route to the line up handler

app.add_url_rule('/lineup', 'lineup', lineup.handler)

run the server by line up(websocket support) instead of defaule app.run()

server = lineup.server(app)
server.serve_forever()

Client

usage

load lineup.js in the html

<script src="static/js/lineup.js"></script>

write your callback function when server announce

function onmessage(data) {
  // data = {'number': <your position in line>,
  //         'total': <total person in line>}
  if (data.number == 0) {
    // do what you want to do 
  } else {
    // you should still waiting
  }
}

finally start the lineup module

lineup.init(websocket_url, onmessage);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages