Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chatgris/event_source_encoder

EventSourceEncoder is a Elixir library to encode data into EventSource compliant data.
https://github.com/chatgris/event_source_encoder

Last synced: 4 days ago
JSON representation

EventSourceEncoder is a Elixir library to encode data into EventSource compliant data.

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/chatgris/event_source_encoder.png?branch=master)](https://travis-ci.org/chatgris/event_source_encoder)
# EventSourceEncoder

EventSourceEncoder is a Elixir library to encode data into EventSource
compliant data.

## Examples

``` elixir
iex> EventSourceEncoder.encode(1, "This is data")
"id: 1\\ndata: This is data\\n\\n"

iex> EventSourceEncoder.encode(1, "This is new data", :login)
"id: 1\\nevent: login\\ndata: This is new data\\n\\n"
```