Skip to content

ElieBen-Shlomo/zio-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZIO-Messenger

Fun little project to play around with some ZIO concepts for the first time. An instant messenger-like app that randomly connects users into pairs to begin chatting.

Screen Shot 2023-02-03 at 1 53 56 PM

Tech stack:

Setup:

Terminal 1:
First, setup database and start server

% bash setup.sh                                                                                                                                                      [32/154]
...
Starting server on http://localhost:9000

Terminal 2:
Second, log in and save login cookie

% curl -v  -X POST 'localhost:9000/login' -d '{"username":"elie"}'
...
set-cookie: Login Cookie={"username":"elie","userId":1,"creationDate":"2023-02-03T13:01:50.086445Z"}; Max-Age=9223372036; Expires=Sun, 16 May 2315 12:49:06 GMT
...

Save cookie (single quotes '' to wrap string)

% export cookie='Login Cookie={"username":"eliee","userId":1,"creationDate":"2023-02-03T13:01:50.086445Z"}; Max-Age=9223372036; Expires=Sun, 16 May 2315 12:49:06 GMT'

Thirdly, connect to server and wait to be paired with someone

% websocat ws://localhost:9000/chat-session -H "Cookie: $cookie"

Welcome elie - waiting to be connected with a pair

Terminal 3: (same process)

% curl -v  -X POST 'localhost:9000/login' -d '{"username":"eddie"}'
...
% export cookie=...
...
% websocat ws://localhost:9000/chat-session -H "Cookie: $cookie"

Connected - You are now chatting with elie

We also have an additional API to see message history (reverse chronological order)

% curl -X GET localhost:9000/messages/ed/ezra

["ezra: Literally nothing bro","ed: Wuu2?","ezra: Yes bro?","ed: Bro"]

Todo:

  • Tests
  • Recover 500 errors
  • Group chat
  • Frontend :D

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors