11# Mint.WebSocket
22
3- ![ CI] ( https://github.com/NFIBrokerage/mint_web_socket/workflows/CI/ badge.svg )
4- [ ![ Coverage Status] ( https://coveralls.io/repos/github/NFIBrokerage/mint_web_socket/ badge.svg )] ( https://coveralls.io/github/NFIBrokerage/mint_web_socket )
5- [ ![ hex.pm version] ( https://img.shields.io/hexpm/v/mint_web_socket.svg )] ( https:// hex.pm/packages/mint_web_socket )
6- [ ![ hex.pm license] ( https://img.shields.io/hexpm/l/mint_web_socket.svg )] ( https://github.com/NFIBrokerage/mint_web_socket/blob/main/LICENSE )
7- [ ![ Last Updated] ( https://img.shields.io/github/ last-commit/NFIBrokerage/mint_web_socket.svg )] ( https://github.com/NFIBrokerage/mint_web_socket/ commits/main )
3+ ![ CI] [ ci- badge]
4+ [ ![ Coverage Status] [ coverage- badge]] [ coverage ]
5+ [ ![ hex.pm version] [ hex-version-badge ]] [ hex-package ]
6+ [ ![ hex.pm license] [ hex-licence-badge ]] [ licence ]
7+ [ ![ Last Updated] [ last-updated-badge ]] [ commits ]
88
99HTTP/1 and HTTP/2 WebSocket support for Mint 🌱
1010
@@ -36,47 +36,40 @@ hello_world_echo_message = receive(do: (message -> message))
3636{:ok , websocket, [{:text , " hello world" }]} = Mint .WebSocket .decode (websocket, data)
3737```
3838
39- Check out some [ examples] ( ./examples ) and the online
40- [ documentation] ( https://hexdocs.pm/mint_web_socket/Mint.WebSocket.html ) .
39+ Check out some [ examples] ( ./examples ) and the online [ documentation] [ hex-docs ] .
4140
4241## Functional WebSockets
4342
44- Mint.WebSocket (like Mint) takes a _ functional_ approach to HTTP and
45- WebSockets. Existing WebSocket implementations like
46- [ ` :gun ` ] ( https://github.com/ninenines/gun ) /
47- [ ` :websocket_client ` ] ( https://github.com/jeremyong/websocket_client ) /
48- [ ` Socket ` ] ( https://github.com/meh/elixir-socket ) /
49- [ ` WebSockex ` ] ( https://github.com/Azolo/websockex ) work by spawning and
43+ Mint.WebSocket (like Mint) takes a _ functional_ approach.
44+ Other WebSocket implementations like
45+ [ ` :gun ` ] [ gun ] / [ ` :websocket_client ` ] [ websocket-client ] /
46+ [ ` Socket ` ] [ socket ] / [ ` WebSockex ` ] [ websockex ] work by spawning and
5047passing messages among processes. This is a very convenient interface in
51- Elixir and Erlang , but it does not allow the author much control over
48+ Erlang and Elixir , but it does not allow the author much control over
5249the WebSocket connection.
5350
5451Instead ` Mint.WebSocket ` is process-less: the entire HTTP and WebSocket
5552states are kept in immutable data structures. When you implement a WebSocket
5653client with ` Mint.WebSocket ` , runtime behavior and process architecture
57- are up to you: you decide how to handle things like reconnection or retry
58- and how to deal with failures .
54+ are up to you: you decide how to handle things like reconnection and failure
55+ handling .
5956
60- For a practical introduction, check out Mint's
61- [ usage documentation] ( https://github.com/elixir-mint/mint#usage ) .
57+ For a practical introduction, check out Mint's [ usage documentation] [ mint-usage ] .
6258
6359## Spec conformance
6460
65- This library aims to follow
66- [ RFC6455] ( https://datatracker.ietf.org/doc/html/rfc6455 ) and
67- [ RFC8441] ( https://datatracker.ietf.org/doc/html/rfc8441 ) as closely as possible
68- and uses [ Autobahn|Testsuite] ( https://github.com/crossbario/autobahn-testsuite )
69- to check conformance with every run of tests/CI. The auto-generated report
70- produced by the Autobahn|Testsuite is uploaded on each push to main.
61+ This library aims to follow [ RFC6455] [ rfc6455 ] and [ RFC8441] [ rfc8441 ] as
62+ closely as possible and uses the [ Autobahn|Testsuite] [ autobahn ] to check
63+ conformance with every run of tests/CI. The auto-generated report produced
64+ by the Autobahn|Testsuite is uploaded on each push to main.
7165
7266See the report here: https://nfibrokerage.github.io/mint_web_socket/
7367
7468## HTTP/2 Support
7569
76- HTTP/2 WebSockets are not a built-in feature of HTTP/2: RFC8441 is an extension
77- to the HTTP/2 protocol and server libraries are not obligated to implement it.
78- In the current landscape, very few server libraries support the RFC8441's
79- extended CONNECT method which bootstraps WebSockets.
70+ HTTP/2 WebSockets are not a built-in feature of HTTP/2. In the current
71+ landscape, very few server libraries support the RFC8441's extended CONNECT
72+ method which bootstraps WebSockets.
8073
8174If ` Mint.WebSocket.upgrade/4 ` returns
8275
@@ -91,7 +84,7 @@ enabled.
9184
9285Contributions are very welcome!
9386
94- If you're Interested in developing ` Mint.WebSocket ` , you'll need docker-compose
87+ If you're interested in developing ` Mint.WebSocket ` , you'll need docker-compose
9588to run the fuzzing test suite. The ` docker-compose.yml ` sets up an Elixir
9689container, a simple websocket echo server, and the Autobahn|Testsuite fuzzing
9790server.
@@ -103,3 +96,25 @@ server.
10396(app)$ mix test
10497(app)$ iex -S mix
10598```
99+
100+ [ ci-badge ] : https://github.com/NFIBrokerage/mint_web_socket/workflows/CI/badge.svg
101+ [ coverage ] : https://coveralls.io/github/NFIBrokerage/mint_web_socket
102+ [ coverage-badge ] : https://coveralls.io/repos/github/NFIBrokerage/mint_web_socket/badge.svg
103+ [ hex-version-badge ] : https://img.shields.io/hexpm/v/mint_web_socket.svg
104+ [ hex-licence-badge ] : https://img.shields.io/hexpm/l/mint_web_socket.svg
105+ [ hex-package ] : https://hex.pm/packages/mint_web_socket
106+ [ licence ] : https://github.com/NFIBrokerage/mint_web_socket/blob/main/LICENSE
107+ [ last-updated-badge ] : https://img.shields.io/github/last-commit/NFIBrokerage/mint_web_socket.svg
108+ [ commits ] : https://github.com/NFIBrokerage/mint_web_socket/commits/main
109+
110+ [ hex-docs ] : https://hexdocs.pm/mint_web_socket/Mint.WebSocket.html
111+
112+ [ gun ] : https://github.com/ninenines/gun
113+ [ websocket-client ] : https://github.com/jeremyong/websocket_client
114+ [ socket ] : https://github.com/meh/elixir-socket
115+ [ websockex ] : https://github.com/Azolo/websockex
116+ [ mint-usage ] : https://github.com/elixir-mint/mint#usage
117+
118+ [ rfc6455 ] : https://datatracker.ietf.org/doc/html/rfc6455
119+ [ rfc8441 ] : https://datatracker.ietf.org/doc/html/rfc8441
120+ [ autobahn ] : https://github.com/crossbario/autobahn-testsuite
0 commit comments