All Projects → francois2metz → Em Eventsource

francois2metz / Em Eventsource

Licence: mit
em-eventsource is an eventmachine library to consume Server-Sent Events streaming API.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Em Eventsource

Plasma
universal server push middleware by using gRPC stream and Server Sent Events(SSE)
Stars: ✭ 151 (+81.93%)
Mutual labels:  eventsource
eventsource ex
Elixir EventSource (Server-Sent Events) client
Stars: ✭ 16 (-80.72%)
Mutual labels:  eventsource
Html
HTML Standard
Stars: ✭ 5,217 (+6185.54%)
Mutual labels:  eventsource
Full Reactive Stack
Full Reactive Stack with Spring Boot (WebFlux), MongoDB and Angular
Stars: ✭ 221 (+166.27%)
Mutual labels:  eventsource
react-native-sse
Event Source implementation for React Native. Server-Sent Events (SSE) for iOS and Android 🚀
Stars: ✭ 51 (-38.55%)
Mutual labels:  eventsource
okhttp-eventsource
Server-sent events (SSE) client implementation for Java, based on OkHttp: http://javadoc.io/doc/com.launchdarkly/okhttp-eventsource
Stars: ✭ 70 (-15.66%)
Mutual labels:  eventsource
Aiohttp Sse
Server-sent events support for aiohttp
Stars: ✭ 125 (+50.6%)
Mutual labels:  eventsource
Eventsource
Rust client for the EventSource browser API
Stars: ✭ 9 (-89.16%)
Mutual labels:  eventsource
fetch-event-source
A better API for making Event Source requests, with all the features of fetch()
Stars: ✭ 120 (+44.58%)
Mutual labels:  eventsource
ETW2JSON
Tool and library to convert ETW logs to JSON files
Stars: ✭ 66 (-20.48%)
Mutual labels:  eventsource
Php Sse
A simple and efficient library implemented HTML5's server-sent events by PHP, is used to real-time push events from server to client, and easier than Websocket, instead of AJAX request.
Stars: ✭ 237 (+185.54%)
Mutual labels:  eventsource
rust-eventsource-client
Server-sent events (SSE) client implementation for Rust
Stars: ✭ 24 (-71.08%)
Mutual labels:  eventsource
ruby-eventsource
Server-sent events (SSE) client implementation for Ruby
Stars: ✭ 19 (-77.11%)
Mutual labels:  eventsource
Unifrost
Making it easier to push pubsub events directly to the browser.
Stars: ✭ 166 (+100%)
Mutual labels:  eventsource
Eventsource
EventSource client for Node.js and Browser (polyfill)
Stars: ✭ 541 (+551.81%)
Mutual labels:  eventsource
Eventflow.example
DDD+CQRS+Event-sourcing examples using EventFlow following CQRS-ES architecture. It is configured with RabbitMQ, MongoDB(Snapshot store), PostgreSQL(Read store), EventStore(GES). It's targeted to .Net Core 2.2 and include docker compose file.
Stars: ✭ 131 (+57.83%)
Mutual labels:  eventsource
sseserver
🏄 High-performance Server-Sent Events endpoint for Go
Stars: ✭ 88 (+6.02%)
Mutual labels:  eventsource
Jquery Sse
jQuery Plugin for Server-Sent Events (SSE) EventSource Polyfill
Stars: ✭ 37 (-55.42%)
Mutual labels:  eventsource
Centrifugo
Scalable real-time messaging server in a language-agnostic way. Set up once and forever.
Stars: ✭ 5,649 (+6706.02%)
Mutual labels:  eventsource
CQRS-ES-Framework-Laravel
Laravel Adapter for CQRS-ES-Framework
Stars: ✭ 15 (-81.93%)
Mutual labels:  eventsource

EventSource client for EventMachine

See the specification: https://html.spec.whatwg.org/multipage/server-sent-events.html

Install

Install with Rubygems:

gem install em-eventsource

If you use bundler, add it to your Gemfile:

gem "em-eventsource", "~> 0.3.0"

Usage

Basic usage:

require "em-eventsource"
EM.run do
  source = EventMachine::EventSource.new("http://example.com/streaming")
  source.message do |message|
    puts "new message #{message}"
  end
  source.start # Start listening
end

Listening specific event name:

source.on "eventname" do |message|
  puts "eventname #{message}"
end

Handle error:

source.error do |error|
  puts "error #{error}"
end

Handle open stream:

source.open do
  puts "opened"
end

Close the stream:

source.close

Current status of the connection:

# Can be:
# - EM::EventSource::CLOSED
# - EM::EventSource::CONNECTING
# - EM::EventSource::OPEN
source.ready_state

Override the default retry value (if the connection is lost):

source.retry = 5 # in seconds (default 3)

Get Last-Event-Id value:

source.last_event_id

Attach middleware:

source.use EM::Middleware::JSONResponse

Set the inactivity timeout. Set to 0 to disable the timeout.

source.inactivity_timeout = 120 # in seconds (default: 60).

Licence

MIT License

Copyright (C) 2020 François de Metz

Copyright (C) 2011 af83

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].