Skip to content

fpinscala-muc/akka-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

akka-chat

A simple chat server using Akka and Scala.

1. First Version Commit

  • actor ChatServer: Join and Leave the chat group, Broadcast an incoming message to all current chat members
  • actor ChatClient: Join the chat group, Broadcast a first intro message
  • ChatApp: first running App with three ChatClients

2. Second Version

  • added support for SSE using Heiko Seeberger's akka-sse library.

Try it out

Clone this repository, cd into it and start sbt. Then execute run and choose org.sandbox.chat.http.HttpChatApp:

akka-chat$ sbt
[info] ...
akka-chat$ run
[info] ...
Multiple main classes detected, select one to run:

 [1] org.sandbox.chat.http.HttpChatApp
 [2] org.sandbox.chat.ChatApp

Enter number: 1
[info] ...

Open a second console and start an SSE session on port 9000:

~$ curl -X GET http://localhost:9000

Open a third console and send chat client commands to the server on port 8080. You will see the respective commands as SSEs sent to the second console:

~$ curl -X GET http://localhost:8080/join/Achim
~$ curl -X POST --data 'one line
another line' http://localhost:8080/contrib/Achim
~$ curl -X GET http://localhost:8080/join/Michael
~$ curl -X PUT --data 'one line again
and yet another line' http://localhost:8080/contrib/Michael
~$ curl -X GET http://localhost:8080/poll/Achim
~$ curl -X GET http://localhost:8080/leave/Michael
~$ curl -X GET http://localhost:8080/shutdown/shutdown

The Akka HTTP endpoints are defined in ChatRoutes.

Alt text Details: https://snap-ci.com/fpinscala-muc/akka-chat/branch/master

About

Simple chat server using Akka and Scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages