Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] initial draft of delegate server #217

Conversation

MangoIV
Copy link
Contributor

@MangoIV MangoIV commented Mar 27, 2023

  • add Delegate Server and types
  • rewrite the Main to work with a proper server
  • some changes to handle serialisation

- add Delegate Server and types
- rewrite the Main to work with a proper server
- some changes to handle serialisation
@MangoIV
Copy link
Contributor Author

MangoIV commented Mar 28, 2023

I think a possible solution for the concurrency issue is having a TChan that the DelegateRunner knows and then every tick read of the TChan all FrontendRequests, then do stuff, after that write to a broadCastTChan which will then be cloned by the clients as soon as they're spawned with dupTChan

@MangoIV
Copy link
Contributor Author

MangoIV commented Mar 28, 2023

I will implement that tomorrow then

@MangoIV
Copy link
Contributor Author

MangoIV commented Mar 28, 2023

Inwards it can be a TQueue, I think. Outwards I'll use TChan

@nazrhom
Copy link
Collaborator

nazrhom commented Mar 29, 2023

Hey @MangoIV have a look at this pr I have already added a Chan to queue events in, and delegateStep can consume that directly.

Also - this might have been already discussed - but I don't think we should pass a tick here. Ideally we can listen for websocket connections and spawn a thread thread to handle each incoming request.

- two channels, an incoming and an outgoing one
- incoming channel receives from all clients and gets flushed by the
  consumer
- outgoing channel is a broadcast channel that gets cloned by each
  client and then sends all events back to the frontend
- factor out Tracing in a separate module
- remove tagless final style where sensible
- haddock
@MangoIV MangoIV force-pushed the mangoiv/175-implement-real-network-interface-to-be-used-by-frontend-for-delegate-server branch from 1e49810 to 788f0d6 Compare March 31, 2023 16:42
@MangoIV MangoIV marked this pull request as ready for review March 31, 2023 16:46
@MangoIV MangoIV requested a review from a team as a code owner March 31, 2023 16:46
@MangoIV MangoIV requested a review from uhbif19 March 31, 2023 16:46
- fixes that Gregory requested
- nicer logging
- some fork off handler
@MangoIV MangoIV force-pushed the mangoiv/175-implement-real-network-interface-to-be-used-by-frontend-for-delegate-server branch from 788f0d6 to 3cdeb11 Compare March 31, 2023 17:23
Copy link
Contributor

@uhbif19 uhbif19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still think mbQueueAuctionPhases is not best way to separate function.

subscribes to the broadcast channel and sends to
the incoming channel of the delegate runner
-}
delegateServerApp ::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand naming of this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a ServerApp and specifically the serverApp that is run by the delegate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is app in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it's a ServerApp, which is a function from PendingConnection -> IO () https://hackage.haskell.org/package/websockets-0.12.7.3/docs/Network-WebSockets.html#t:ServerApp

…ent-real-network-interface-to-be-used-by-frontend-for-delegate-server
@MangoIV MangoIV requested review from uhbif19 and nazrhom April 3, 2023 10:46
- derivive pretty via show instead of using viaShow directly
- more documentation
- more where clauses where possible
- separation of the startWorker function
- factor out some part of the serverlog
@nazrhom
Copy link
Collaborator

nazrhom commented Apr 4, 2023

Looks like all conversations are resolved here. LGTM

@uhbif19 uhbif19 closed this Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement real network interface to be used by Frontend for Delegate server
3 participants