WebSocket Sample

The sample process

  • Send event to Web Socket for getting order id
  • Web Socket connects MySQL orders table and get next order id
  • Send event back to client with message and next order id

Sample Environment

  • Node.js
    • Modules: mysql, socket.io
  • PHP
  • MySQL

Filename: serverfile.js

 

Filename: client.html

 

* Note that above code is just study purpose only.