Skip to content

Commit

Permalink
Merge pull request #77 from imanhodjaev/master
Browse files Browse the repository at this point in the history
Add an example for authentication
  • Loading branch information
Azolo authored Oct 19, 2019
2 parents 58a8b26 + cf6c5c1 commit ce7064e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/auth_headers.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule AuthHeaders do
use WebSockex

@moduledoc ~S"""
Sample usage connecting to server using authorization.
You can specify `extra_headers` in as fourth parameter to
`WebSockex.start_link/4` which then will be used build
connection to websocket server.
"""

def start_link(url, state) do
extra_headers = [
{"Authorization", "JWT ..."}
]

WebSockex.start_link(url, __MODULE__, state, extra_headers: extra_headers)
end
end

0 comments on commit ce7064e

Please sign in to comment.