mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-09-24 12:56:42 +00:00
Implement websocket communication with kj-http
Now that capnp/kj provides http and websocket functions, replace the excellent websocketpp library with the kj functions. This removes a dependency and allows for more consistent idiomatic code. Thanks websocketpp, it was great to have you along! This should enable parts of the refactor described in #49
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#define LAMINAR_SERVER_H_
|
||||
|
||||
#include <kj/async-io.h>
|
||||
#include <kj/compat/http.h>
|
||||
#include <capnp/message.h>
|
||||
#include <capnp/capability.h>
|
||||
#include <functional>
|
||||
@@ -50,21 +51,19 @@ public:
|
||||
void addWatchPath(const char* dpath);
|
||||
|
||||
private:
|
||||
kj::Promise<void> acceptHttpClient(kj::Own<kj::ConnectionReceiver>&& listener);
|
||||
kj::Promise<void> acceptRpcClient(kj::Own<kj::ConnectionReceiver>&& listener);
|
||||
kj::Promise<void> handleFdRead(kj::AsyncInputStream* stream, char* buffer, std::function<void(const char*,size_t)> cb);
|
||||
|
||||
void taskFailed(kj::Exception&& exception) override;
|
||||
|
||||
private:
|
||||
struct WebsocketConnection;
|
||||
class HttpImpl;
|
||||
|
||||
int efd_quit;
|
||||
capnp::Capability::Client rpcInterface;
|
||||
LaminarInterface& laminarInterface;
|
||||
kj::Own<HttpImpl> httpInterface;
|
||||
kj::AsyncIoContext ioContext;
|
||||
kj::HttpHeaderTable headerTable;
|
||||
kj::Own<kj::HttpService> httpService;
|
||||
kj::Own<kj::HttpServer> httpServer;
|
||||
kj::Own<kj::TaskSet> listeners;
|
||||
kj::TaskSet childTasks;
|
||||
kj::TaskSet httpConnections;
|
||||
|
||||
Reference in New Issue
Block a user