web_socket alternatives and similar packages
Based on the "HTTP" category.
Alternatively, view web_socket alternatives based on common mentions on social networks and blogs.
-
mint
Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱 -
Crawly
Crawly, a high-level web crawling & scraping framework for Elixir. -
PlugAttack
A plug building toolkit for blocking and throttling abusive requests -
spell
Spell is a Web Application Messaging Protocol (WAMP) client implementation in Elixir. WAMP is an open standard WebSocket subprotocol that provides two application messaging patterns in one unified protocol: Remote Procedure Calls + Publish & Subscribe: http://wamp.ws/ -
http_proxy
http proxy with Elixir. wait request with multi port and forward to each URIs -
explode
An easy utility for responding with standard HTTP/JSON error payloads in Plug- and Phoenix-based applications -
Mechanize
Build web scrapers and automate interaction with websites in Elixir with ease! -
mnemonic_slugs
An Elixir library for generating memorable slugs. -
uri_template
RFC 6570 compliant URI template processor for Elixir -
fuzzyurl
An Elixir library for non-strict parsing, manipulation, and wildcard matching of URLs. -
ivar
Ivar is an adapter based HTTP client that provides the ability to build composable HTTP requests. -
SpiderMan
SpiderMan,a base-on Broadway fast high-level web crawling & scraping framework for Elixir. -
uri_query
URI encode nested GET parameters and array values in Elixir -
http_digex
HTTP Digest Auth Library to create auth header to be used with HTTP Digest Authentication -
lhttpc
What used to be here -- this is a backwards-compat user and repo m( -
Ralitobu.Plug
Elixir Plug for Ralitobu, the Rate Limiter with Token Bucket algorithm
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of web_socket or a related project?
README
WebSocket
An exploration into a stand-alone library for Plug applications to easily adopt WebSockets.
Viewing the examples
Run these:
$ git clone https://github.com/slogsdon/plug-web-socket
$ cd plug-web-socket
$ mix deps.get
$ iex -S mix run run_examples.exs
Go here: http://localhost:4000.
You will be presented with a list of possible examples/tests that use a WebSocket connection.
Integrating with Plug
If you're looking to try this in your own test application, do something like this:
defmodule MyApp.Router do
use Plug.Router
use WebSocket
# WebSocket routes
# route controller/handler function & name
socket "/topic", MyApp.TopicController, :handle
socket "/echo", MyApp.EchoController, :echo
# Rest of your router's plugs and routes
# ...
def run(opts \\ []) do
dispatch = dispatch_table(opts)
Plug.Adapters.Cowboy.http __MODULE__, opts, [dispatch: dispatch]
end
end
For the time being, there is a run/1
function
generated for your router that starts a HTTP/WS
listener. Not sure if this will stay or get
reduced to helper functions that aid in the
creation of a similar function. Most likely the
latter will win out to help compose functionality.
The big part that it plays is the building of a
dispatch table to pass as an option to Cowboy that
has an entry for each of your socket routes and a
catch all for HTTP requests.
Add the necessary bits to a module
From the topic example:
defmodule MyApp.TopicController do
def handle(:init, state) do
{:ok, state}
end
def handle(:terminate, _state) do
:ok
end
def handle("topic:" <> letter, state, data) do
payload = %{awesome: "blah #{letter}",
orig: data}
{:reply, {:text, payload}, state}
end
end
Currently, the function name needs to be unique across all controllers/handlers as its used for the Events layer.
Broadcast from elsewhere
Need to send data out from elsewhere in your app?
# Build your message
topic = "my_event"
data = %{foo: "awesome"}
mes = WebSocket.Message.build(topic, data)
json = Poison.encode!(mes)
# Pick your destination (from your routes)
name = :handle
# Send away!
WebSockets.broadcast!(name, json)
This needs to be nicer, but this is still in progress.
License
WebSocket is released under the MIT License.
See LICENSE for details.
*Note that all licence references and agreements mentioned in the web_socket README section above
are relevant to that project's source code only.