/chat

dumbed down irc

Primary LanguageErlang

To start a server use
    (a@host)1>chat_server_sup:start_link().
    (a@host)2>chat_server_sup:start(foo).

Additional servers can be started on the same or different node, i.e.
    (b@host)1>chat_server_sup:start_link().
    (b@host)2>chat_server_sup:start(bar).

Finally servers can be connected to a cluster by specifying one of the names
of the cluster servers. It is important to note, though, that the server
will loose all of it's users and channels upon doing so. The idea is to 
connect servers to a cluster right after starting them. Therefore
    (b@host)3>chat_server:connect(bar, foo).

would connect bar to foo.

Now users can connect to any of the foo or bar, they will see each other,
have access to the same channel list, be able to join channels and
chat both privatly and on the channels. Chat clients can be spawned both
on the same node as the server and on different nodes.

    (c@host)1>chat_client_sup:start_link().
    (c@host)2>chat_client_sup:start().
    (c@host)3>chat_client:sign_in(foo, "Alice").
    (c@host)4>chat_client:list_names().
    [["Alice"]]

    ...

    (d@host)1>chat_client_sup:start_link().
    (d@host)2>chat_client_sup:start().
    (d@host)3>chat_client:sign_in(bar, "Bob").
    (d@host)4>chat_client:list_names().
    [["Alice"],["Bob"]]

And some examples of others commands:

    (d@host)5>chat_client:send("Alice", "Hi").
    (d@host)6>chat_client:create(channel).
    (d@host)7>chat_client:join(channel).
    (d@host)8>chat_client:send_channel(channel, "hello world").
    (d@host)9>chat_client:leave(channel).
    (d@host)10>chat_client:shutdown().