Popularity
4.4
Declining
Activity
0.0
Declining
20
3
0
Programming language: Crystal
License: MIT License
Tags:
HTTP
Latest version: v0.8.0
sse.cr alternatives and similar shards
Based on the "HTTP" category.
Alternatively, view sse.cr alternatives based on common mentions on social networks and blogs.
-
halite
💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares. -
Cable
It's like ActionCable (100% compatible with JS Client), but you know, for Crystal -
cossack
Simple and flexible HTTP client for Crystal with middleware and test support. -
http-protection
This library protects against typical web attacks. It was inspired in rack-protection Ruby gem. -
helmet
a port of the Node Helmet module to the Crystal programming language -
crystal-routing
Extensible library to deal with http request and string based routing in Crystal -
http-params-serializable
The HTTP params parsing module for Crystal 🤓 -
http_parser.cr
Crystal wrapper for Http Parser lib: https://github.com/joyent/http-parser -
multipart.cr
Adds multipart and multipart/form-data support to the crystal standard library -
ContentDisposition
Crystal shard to create HTTP Content-Disposition headers with proper escaping/encoding of filenames -
http_distributor
http server which allows sneaky http request though it. -
crystal-cossack
Simple and flexible HTTP client for Crystal with middleware and test support.
Learn any GitHub repo in 59 seconds
Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
Promo
getonboard.dev
Do you think we are missing an alternative of sse.cr or a related project?
README
Server-Sent Events
Server-Sent Events server/client for Crystal.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
sse:
github: y2k2mt/sse.cr
- Run
shards install
Usage
Client
require "sse"
sse = HTTP::ServerSentEvents::EventSource.new("http://127.0.0.1:8080")
sse.on_message do |message|
# Receiving messages from server
p message.data
end
sse.run
Server
require "sse"
server = HTTP::Server.new [
HTTP::ServerSentEvents::Handler.new { |es, _|
es.source {
# Delivering event data every 1 second.
sleep 1
HTTP::ServerSentEvents::EventMessage.new(
data: ["foo", "bar"],
)
}
},
]
server.bind_tcp "127.0.0.1", 8080
server.listen
Running server and you can get then:
$ curl 127.0.0.1:8080 -H "Accept: text/event-stream"
data: foo
data: bar
data: foo
data: bar
...
Contributing
- Fork it (https://github.com/y2k2mt/sse.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- y2k2mt - creator and maintainer