Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timbuchwaldt/realchat
THE real chat
https://github.com/timbuchwaldt/realchat
Last synced: about 2 months ago
JSON representation
THE real chat
- Host: GitHub
- URL: https://github.com/timbuchwaldt/realchat
- Owner: timbuchwaldt
- Created: 2014-05-25T13:13:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-25T20:21:33.000Z (over 10 years ago)
- Last Synced: 2024-04-15T02:59:45.054Z (9 months ago)
- Language: Elixir
- Size: 107 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Realchat
========Usage:
* Start 2 iex shells via ```iex --name "foo" -S mix``` and ```iex --name "bar" -S mix```
* Connect the two(only on one shell): ```Node.ping(:"[email protected]")``` (replace nebuchadnezzar with the hostname shown on the other shell)
* Verify 'pong' is returned
* Start the GenEvent-Server on shell 1: ```{:ok, pid} = GenEvent.start_link()```
* Register the eventhandler globally on shell 1: ```:global.register_name(:gen_event, pid)```
* On Shell one: Register: ```GenEvent.call(pid, Server, {:register, self()})```
* On Shell two:
* Find the remote PID ``` pid = :global.whereis_name(:gen_event)```
* Register: ```GenEvent.call(pid, Server, {:register, self()})```
* Send a message from any of the shells: ```GenEvent.notify(pid, {:message, "test"})```
* Flush the local mailbox on the two shells: ```flush()```