Coder Social home page Coder Social logo

socket-io-demo's Introduction

Demo for socket.io

Running this app

Assuming you have nodejs setup

  • If you are running for the first time , npm install

  • To run the app, npm start

Testing the app

  • open the url http://<hostname>:8080

  • prepare a payload in json format

Use case 1 : booking request

Create the following payload in a file, e.g. payload.json

{ 
  "traveller": "Jim",  
  "flightReq" : 
   { "flightFrom": "GRU",
     "flightTo": "SCL",
     "flightDate": "2017-02-28",
     "flightPassengers": 5,
     "flightNo": "TA12" },
  "hotelReq": 
   { "hotelArrivalDate": "2017-02-28",
     "hotelNights": 50,
     "hotelCity": "SCL",
     "hotelId": "SheratonSantiago" },
  "carReq": 
   { "carCity": "SCL",
     "carRentalCo": "Hertz",
     "carType": "Econ",
     "carStartDate": "2017-02-28",
     "carDays": 50 } 
}
  • fire the command

curl -X POST -H "Content-Type: application/json" -d @payload.json http://<host>:8080/events

You should see some text being displayed on the browser

Use case 2 :POD counts

Create the following payload in a file, e.g. payload.json

{ "podCount" : "5" }

e.g. curl -X POST -H "Content-Type: application/json" -d '{"podCount":"5"}' http://<host>/events;

  • fire the command

You should see some text being displayed on the browser

Use case 3 : Event from backend

Create the following payload in a file, e.g. payload.json

{ "event" : "fuse" }

Note the additional path

e.g. curl -X POST -H "Content-Type: application/json" -d '{"event":"fuse"}' http://<host>/events/fuse;

  • fire the command

You should see some text being displayed on the browser

socket-io-demo's People

Contributors

wohshon avatar

Stargazers

Andy Fitzsimon avatar

Watchers

James Cloos avatar Andy Fitzsimon avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.