Current section
3 Versions
Jump to
Current section
3 Versions
Compare versions
4
files changed
+34
additions
-3
deletions
| @@ -1,3 +1,33 @@ | |
| 1 1 | [](https://hex.pm/packages/janus_ws) |
| 2 2 | |
| 3 3 | For interacting with [Janus WebRTC Gateway](https://github.com/meetecho/janus-gateway) via WebSockets. |
| 4 | + |
| 5 | + #### Example project |
| 6 | + |
| 7 | + https://github.com/janus-ex/janus_ws_example |
| 8 | + |
| 9 | + #### Debugging |
| 10 | + |
| 11 | + Same as in [`:websockex`](https://github.com/Azolo/websockex#debugging): |
| 12 | + |
| 13 | + ```elixir |
| 14 | + iex(1)> {:ok, client} = Janus.start_link(url: "ws://localhost:8188", registry: some_registry, debug: [:trace]) |
| 15 | + |
| 16 | + *DBG* #PID<0.209.0> attempting to connect |
| 17 | + *DBG* #PID<0.209.0> sucessfully connected |
| 18 | + *DBG* #PID<0.209.0> received cast msg: {:create_session, "Mbcb4i8dMfg", #PID<0.208.0>} |
| 19 | + *DBG* #PID<0.209.0> replying from :handle_cast with {:text, "{\"janus\":\"create\",\"transaction\":\"Mbcb4i8dMfg\"}"} |
| 20 | + *DBG* #PID<0.209.0> received frame: {:text, "{\"janus\":\"success\",\"transaction\":\"Mbcb4i8dMfg\",\"data\":{\"id\":818647816905897}}"} |
| 21 | + *DBG* #PID<0.209.0> sending frame: {:text, "{\"janus\":\"destroy\",\"session_id\":818647816905897,\"transaction\":\"adZA+FChr1M\"}"} |
| 22 | + *DBG* #PID<0.209.0> received frame: {:text, "{\"janus\":\"success\",\"session_id\":818647816905897,\"transaction\":\"adZA+FChr1M\"}"} |
| 23 | + |
| 24 | + iex(2)> :sys.trace(client, false) |
| 25 | + |
| 26 | + # ... silence ... |
| 27 | + |
| 28 | + iex(3)> :sys.trace(client, true) |
| 29 | + |
| 30 | + *DBG* #PID<0.209.0> received frame: {:text, "{\"janus\":\"ack\",\"session_id\":7564472917324192,\"transaction\":\"0Al6pqcEPgY\"}"} |
| 31 | + *DBG* #PID<0.209.0> sending frame: {:text, "{\"candidate\":{\"completed\":true},\"handle_id\":8087962335175224,\"janus\":\"trickle\",\"session_id\":7564472917324192,\"transaction\":\"2g2m/wtyBRU\"}"} |
| 32 | + *DBG* #PID<0.209.0> received frame: {:text, "{\"janus\":\"ack\",\"session_id\":7564472917324192,\"transaction\":\"2g2m/wtyBRU\"}"} |
| 33 | + ``` |
| @@ -19,4 +19,4 @@ | |
| 19 19 | {<<"optional">>,false}, |
| 20 20 | {<<"repository">>,<<"hexpm">>}, |
| 21 21 | {<<"requirement">>,<<"~> 0.4.2">>}]]}. |
| 22 | - {<<"version">>,<<"0.1.1">>}. |
| 22 | + {<<"version">>,<<"0.1.2">>}. |
| @@ -26,7 +26,8 @@ defmodule Janus.WS do | |
| 26 26 | def start_link(opts) do |
| 27 27 | websockex_opts = [ |
| 28 28 | name: opts[:name], |
| 29 | - extra_headers: [{"Sec-WebSocket-Protocol", "janus-protocol"}] |
| 29 | + extra_headers: [{"Sec-WebSocket-Protocol", "janus-protocol"}], |
| 30 | + debug: opts[:debug] |
| 30 31 | ] |
| 31 32 | |
| 32 33 | websockex_opts = Enum.reject(websockex_opts, fn {_k, v} -> is_nil(v) end) |
| @@ -1,7 +1,7 @@ | |
| 1 1 | defmodule Janus.WS.MixProject do |
| 2 2 | use Mix.Project |
| 3 3 | |
| 4 | - @version "0.1.1" |
| 4 | + @version "0.1.2" |
| 5 5 | |
| 6 6 | def project do |
| 7 7 | [ |