Giter VIP home page Giter VIP logo

server-sent-events's Introduction

Server Sent Events

Service for sending real time events to the client

Server sent event

Service is using Server Sent Event for one-way communication with client. SSE mozilla web doc refrence

Events are returned as text/event-stream divided into

  • data: returns json string with body object, includes ISO-8601 timestamp
  • event: returns type of event
  • id: id of event used to keep track of which event was received by client

API

Endpoints

Path Method Description Headers Body
/events GET Subscribe for events for given member Member-ID, Device-Id, Last-Event-ID
/events POST Publish Event to given member Member-ID Event

Event object

Structure:

{
    "event": {
        "type": "EVENT_TYPE_WITH_UPPER_CASE",
        "body": {
            "examplePropertyOfEvent": "exampleValueOfProperty"
        }
    }
}

Testing

You can use included postman collection for publishing the events. However, postman does not support event-stream content type, so for receiving the events you need to use another client, for instace:

 curl -i -H "MemberId: 123" http://localhost:8080/notification/events

server-sent-events's People

Contributors

mkapiczy 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.