bradmartin / deno-chat

Deno telnet chat server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat Server written in TS running with Deno

Deno Chat

Outline

  • Run this project (see development section below) on your machine (the server).
  • In a terminal telnet localhost <port> - Default port for this project is 8080 (more below to pass the port argument).
  • Once you are connected via telnet to the server. You will see a welcome message on the next steps. Everything should work well enough with simple UX that no further instructions are needed.
  • However, this is what should happen :) -- You should be informed of rooms on the server and told to login. After you /login with a username, you can then join or create chatrooms. -- /join <chatroom> will join an existing room or will create a new chatroom and you will be the admin of the room allowing you to kick other users from the chatroom with the /kick <chatroom> <username> command. -- There also exists a /block <username> command which will prevent you from receiving any messages from the blocked user. -- Private message functionality exists to send messages private and directly to the user specified with /pm <username> <your message>. This is also in sync with the blocked users. So if you have someone blocked, you should not receive messages from them.

A full list of the commands are below in the "Server Commands" section. If you want to browse the commands while connected to the server. Enter /info and a list will print to make it easier to find the various options.

Setup

You will need Deno installed. Installation Guide here.

// to insall on mac with homebrew
brew install deno

If you have npm installed you can use some npm scripts below, if not the deno commands work just fine (see package.json scripts for more).

Development

deno run --allow-all --watch=./**/*.ts ./main.ts -p 4040. or with npm npm run dev

  • This will build and start the server. Default port is 8080. If you pass the -p <value> argument you can set the port to listen on.

Build Executables (Unstable in Deno right now)

deno compile --allow-all --output=./build/chat_server ./main.ts or with npm npm run build

Server Commands

Deno Chat Commands

/INFO - List available commands. πŸ™‹β€β™‚οΈ

/LOGIN - Authenticate with the server. πŸ”‘

/LOGOUT - Log out. πŸ”

/JOIN - Join a chatroom, create if it doesn't exist. πŸšΆπŸ»β€β™‚οΈπŸšͺ

/LEAVE - Leave a chatroom. πŸšͺπŸƒβ€β™‚οΈ

/CHATTERS - List users in a chatroom. πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦

/ROOM - List your active chatroom. πŸ“Ί

/ROOMS - List all available chatrooms. πŸ‘€

/KICK - Kick a user from a chatroom you're an admin of. πŸ₯Ύ

/BLOCK - Block a user to avoid seeing their messages. πŸ›‘

/BLOCKED - List of users you have blocked. πŸ›‘

/ALL_USERS - List users on the server. πŸ—£

/PM - Send a private message to user. 🀫

/WHOAMI - Show user information. ℹ️

/IP - Get your IP address. 🌎


Dependencies

  • No external dependencies.

Why Deno

Deno being stable for some time now and its creators being the same as the original creators of Node makes it a very exciting and potentially strong framework moving forward. Its first class TS support made everything fairly simple to get up and running. You can read more about Deno here.

About

Deno telnet chat server


Languages

Language:TypeScript 100.0%