-
-
Notifications
You must be signed in to change notification settings - Fork 406
Description
API unification
Hyperion has a lot of different ways for communication. Sadly it is in a whole very incomplete.
Depending on origin source data you need different processing wrappers before you can talk to a final hyperion interface.
Currently it's this:
JsonServer HTTP Server ProtoServer UdpServer(listener)
| | | |
-- Hyperion API (all function -udp!)-- Hyperion API (some functions) Hyperion API (1 unique function)
I want to merge all functions into one api class. So the final structure should look like this.
JsonServer HTTP Server+(Websocket!) ProtoServer UdpServer(listener)
| | | |
----------JSON PROCESS ------- ProtoDef ???
| | |
----------------------- Hyperion API ----------------------
No clue about udp, yet. For sure @penfold42 can leave some words :)
This has also some more interesting stuff at the backhand:
JsonServer HTTP Server+(Websocket!) ProtoServer UdpServer(listener)
| | | |
----------JSON PROCESS ------- ProtoDef ??? EffectEngine PluginEngine
| | | | |
------------------------ Hyperion API -------------------------------------------------------------
TcpServer merge
I also want to bring in something different, our massive usage of TcpServer (ports). I won't think about encrpyted TcpServer! ports x2(?)
This are: HTTP Server, Json-Server, protoServer and if you follow the qt5websocket mindset: Websockets
So the final structure would be this together with the API unification:
---------------------------- TcpServer ---------------------------- UdpServer
| | | | |
HTTP Handler Websocket Handler Json Handler (raw) proto Handler |
| | | | |
----------JSON PROCESS ---------- ProtoDef ???
| | | |
------------------------- Hyperion API ------------------------------------------
They all have just some tinys diffs. In order to decide which handler should be used, the first message will be awaited and a sock->peek() will create a copy of the buffer. This copy will be examined for the following:
- Websocket Handler -> Check for HTTP Header and handshake
- HTTP Handler -> Message contains HTTP Header
- Json Handler -> A command ends with /n, the streaming nature might be a problem, because it's not granted that a full command will be there. Maybe search for a "command" phrase,
- proto -> Everything else(?), sort of detection available? isReadable()?
So the Handlers do now the following:
- take ownership of the tcpSocket until it's closed
- process whatever required
Test
I successfully captured the first readyRead signal from the webserver in order to peek the message, and forward to the http processing. However you need to trigger the slot of the readyRead signal the first time by hand as the first readyRead has been captured by the webserver. Another idea is to hand over the buffer in a additional argument.
@penfold42
@redPanther
@Paulchen-Panther Ich hoffe das ist lesbar!
Leave your thoughts