All Projects → SAFE-Stack → Safe Chat

SAFE-Stack / Safe Chat

Licence: mit
IRC-style chat demo featuring full-stack F#, Akka.Streams, Akkling, Fable, Elmish, Websockets and .NET Core

Programming Languages

fsharp
127 projects

Projects that are alternatives of or similar to Safe Chat

akka-http-circe-json-template
Akka HTTP REST API Project Template using Akka HTTP 10.0.4 with Circe 0.7.0 targeting Scala 2.12.x
Stars: ✭ 21 (-86.62%)
Mutual labels:  akka, akka-streams
Scale
Another example of a REST API with Akka HTTP
Stars: ✭ 23 (-85.35%)
Mutual labels:  akka-streams, akka
Akka-Streams-custom-stream-processing-examples
Demos of how to do custom stream processing using the Akka Streams GraphStages API
Stars: ✭ 13 (-91.72%)
Mutual labels:  akka, akka-streams
alpakka-samples
Example projects building Reactive Integrations using Alpakka
Stars: ✭ 61 (-61.15%)
Mutual labels:  akka, akka-streams
Travesty
Diagram- and graph-generating library for Akka Streams
Stars: ✭ 83 (-47.13%)
Mutual labels:  akka-streams, akka
khermes
A distributed fake data generator based in Akka.
Stars: ✭ 94 (-40.13%)
Mutual labels:  akka, akka-streams
Es Cqrs Shopping Cart
A resilient and scalable shopping cart system designed using Event Sourcing (ES) and Command Query Responsibility Segregation (CQRS)
Stars: ✭ 19 (-87.9%)
Mutual labels:  akka-streams, akka
Quark
Quark is a streaming-first Api Gateway using Akka
Stars: ✭ 13 (-91.72%)
Mutual labels:  akka, akka-streams
Akka Http
The Streaming-first HTTP server/module of Akka
Stars: ✭ 1,163 (+640.76%)
Mutual labels:  akka, websocket
Akka Wamp
WAMP - Web Application Messaging Protocol implementation written with Akka
Stars: ✭ 45 (-71.34%)
Mutual labels:  akka, websocket
slicebox
Microservice for safe sharing and easy access to medical images
Stars: ✭ 18 (-88.54%)
Mutual labels:  akka, akka-streams
Squbs
Akka Streams & Akka HTTP for Large-Scale Production Deployments
Stars: ✭ 1,365 (+769.43%)
Mutual labels:  akka-streams, akka
akka-cookbook
提供清晰、实用的Akka应用指导
Stars: ✭ 30 (-80.89%)
Mutual labels:  akka, akka-streams
Akka
Examples and explanations of how Akka toolkit works
Stars: ✭ 20 (-87.26%)
Mutual labels:  akka, akka-streams
akka-streams-interleaving
Akka Streams example of how to interleave Sources with priorities
Stars: ✭ 28 (-82.17%)
Mutual labels:  akka, akka-streams
typebus
Framework for building distributed microserviceies in scala with akka-streams and kafka
Stars: ✭ 14 (-91.08%)
Mutual labels:  akka, akka-streams
Otoroshi
Lightweight api management on top of a modern http reverse proxy
Stars: ✭ 177 (+12.74%)
Mutual labels:  akka-streams, akka
telepooz
Functional Telegram Bot API wrapper for Scala on top of akka, circe, cats, and shapeless
Stars: ✭ 26 (-83.44%)
Mutual labels:  akka, akka-streams
Toketi Iothubreact
Akka Stream library for Azure IoT Hub
Stars: ✭ 36 (-77.07%)
Mutual labels:  akka-streams, akka
Alpakka Kafka
Alpakka Kafka connector - Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,295 (+724.84%)
Mutual labels:  akka-streams, akka

Build Status

F#chat

Sample chat application built with netcore, F#, Akka.net and Fable.

Harvest chat

Requirements

Building and running the app

  • restore dependencies and build application: fake build
  • run the application: fake build -- start

More commands:

  • fake build -- clean build
  • fake build -- restore
  • fake build -- build -- just build, no restore

Alternatively follow the instruction below:

  • change current folder to src/Client folder: cd src/Client
  • Install JS dependencies: yarn
  • Build client bundle: yarn build
  • chdir to src/Server folder: cd ..\Server
  • Install F# dependencies: dotnet restore
  • Run the server: dotnet run
  • Head your browser to http://localhost:8083/

Developing the app

  • Start the server by starting dotnet run in src/Server folder
  • Navigate to src/Client folder
  • Start Fable daemon and Webpack dev server: yarn start
  • In your browser, open: http://localhost:8080/
  • Enjoy HMR (hotload module reload) experience

Running integration (e2e) tests

E2e tests are based on canopy and webdriver so currently I know it runs on Windows. I have no idea how to run in non-windows environment.

  • run the tests: fake build -- test
  • stop script by typing q then pressing Enter

or follow these steps:

  • start the server
  • Move to test/e2e folder: cd test\e2e
  • run the tests: dotnet run

Tests should be run on clean server, but after server became persistent this condition is usually not met (consider cleaning the src/Server/CHAT_DATA folder ny hands).

Implementation overview

Authentication

FsChat supports both permanent users, authorized via goodle or github account, and anonymous ones, those who provide only nickname.

In order to support the google/fb authentication scenario, fill in the client/secret in the CHAT_DATA/suave.oauth.config file. In case you do not see this file, run the server once and the file will be created automatically.

Akka streams

FsChat backend is based on Akka.Streams. The entry point is a GroupChatFlow module which implements the actor, serving group chat.

UserSessionFlow defines the flows for user and control messages, brings everything together and exposes flow for user session.

AboutFlow is an example of implementing channel with specific purpose, other than chatting

ChatServer is an actor which purpose is to keep the channel list. It's responsible for creating/dropping the channels.

UserStore is an actor which purpose is to know all users logged in. It supposed to be made persistent but it does not work for some reason (I created issue).

SocketFlow implements a flow decorating the server-side web socket.

Akkling

Akkling is an unofficial Akka.NET API for F#. It's not just wrapper around Akka.NET API, but introduces some cool concepts such as Effects, typed actors and many more.

Fable, Elmish

Client is written on F# with the help of Fable and Elmish (library?, framework?). Fable is absolutely mature technology, Elmish is just great.

Communication protocol

After client is authenticated all communication between client and server is carried via WebSockets. The protocol is defined in src/Shared/ChatProtocol.fs file which is shared between client and server projects.

Persistence

Server implementation demonstrates using Akka Persistance to restore server state after restart. It's based on event sourcing. However the server destroys the channels when all users are gone. So all channels created by users are non-permanent and will unlikely be restored after restart.

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].