Giter Club home page Giter Club logo

erl-chat-server's Introduction

What is this?

A simple chat server written in Erlang. It was built with the propose of learn a bit about the language.

How can I run?

Compile: erl -make

Run Erlang VM: erl -pa ebin/

Run chat server: chat_server:start(<PORT>).

How can I interact with the server?

It was defined a communication protocol over TCP. So you can interact with the server sending via TCP known messages.

Protocol

The protocol messages will be described below.

Client to Server

CONNECT:<nick>: Try connection with the server.

SAY:<msg>: Send a public message to the chat room.

PVT:<nick>:<msg>: Send a private message to a specific user.

QUIT:: Disconnect from the server.

Server to Client

CONNECT:OK:<nick1>:<nick2>:(...):<nickN>: Positive response from a CONNECT message sent by client. The online user list is sent in message.

CONNECT:ERROR:<reason>: Negative response from a CONNECT message sent by the client.

PVT:<nick>:<msg>: A private message sent to the client by .

JOIN:<nick>: Notify when someone joined the chat room.

LEFT:<nick>: Notify when someone left the chat room.

References

Here is some helpful references used during the development:

Learn You Some Erlang for Great Good!

A Generic Server Tutorial

A Generalized TCP Server

Erlang Examples: Talk with Sockets

Contributors

Luís Gabriel Lima (luisgabriel)

Rafael Brandão (rafaelbrandao)

erl-chat-server's People

Contributors

luisgabriel avatar rafaelbrandao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

erl-chat-server's Issues

PVT:<nick>:<msg> not work.

Hi! )
From telnet I connecting to server (port server 2221):
telnet 192.168.1.100 2221
CONNECT:User1
CONNECT:Ok:User1

From other terminal I connecting to server withe nick User2 )))

telnet 192.168.1.100 2221
CONNECT:User2
CONNECT:Ok:User2

If I send SAY:Hello it's work.
But If i Send PVT:User1:Hi
Message don't sending.

What's bug?
Thx)

Unable to ssh into server.

I started a server on port 8080.chat_server:start(8080)

I then tried to SSH into the server with

ssh 100.115.92.201 -p 8080

but it gives me this error:

=CRASH REPORT==== 9-Apr-2022::18:32:02.710764 ===
  crasher:
    initial call: tcp_server:accept_loop/1
    pid: <0.85.0>
    registered_name: []
    exception error: no match of right hand side value {"SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2\r\n",
                                                        []}
      in function  chat_server:pre_loop/1 (src/chat_server.erl, line 14)
    ancestors: [chat_server,<0.82.0>]
    message_queue_len: 0
    messages: []
    links: [#Port<0.8>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 968
  neighbours:

I hope later you can add SSH support and/or fix this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.