Skip to content

Commit

Permalink
Add {:reply, frame, state} return examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Azolo committed Jan 22, 2018
1 parent 3bdc9c8 commit a3a1139
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ defmodule WebSocketExample do
IO.puts "Received Message - Type: #{inspect type} -- Message: #{inspect msg}"
{:ok, state}
end

def handle_cast({:send, {type, msg} = frame}, state) do
IO.puts "Sending #{type} frame with payload: #{msg}"
{:reply, frame, state}
end
end
```

Expand Down
5 changes: 5 additions & 0 deletions lib/websockex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ defmodule WebSockex do
IO.puts "Received a message: #{msg}"
{:ok, state}
end
def handle_cast({:send, {type, msg} = frame}, state) do
IO.puts "Sending #{type} frame with payload: #{msg}"
{:reply, frame, state}
end
end
```
"""
Expand Down

0 comments on commit a3a1139

Please sign in to comment.