diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-11-16 00:44:33 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-11-16 00:44:33 (GMT) |
commit | 69d34f5598974dddeab14e0fe9169108362622ec (patch) | |
tree | 17fbdbfc28dd11bc8852b697a262d63b9c76df38 /src/uscxml/server/InterpreterServlet.h | |
parent | f33e8148fc6e214886a8b24fc9d743ee25da7d61 (diff) | |
download | uscxml-69d34f5598974dddeab14e0fe9169108362622ec.zip uscxml-69d34f5598974dddeab14e0fe9169108362622ec.tar.gz uscxml-69d34f5598974dddeab14e0fe9169108362622ec.tar.bz2 |
WebSockets!
Diffstat (limited to 'src/uscxml/server/InterpreterServlet.h')
-rw-r--r-- | src/uscxml/server/InterpreterServlet.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h index 55b97bd..46cc737 100644 --- a/src/uscxml/server/InterpreterServlet.h +++ b/src/uscxml/server/InterpreterServlet.h @@ -27,11 +27,11 @@ namespace uscxml { class Interpreter; -class InterpreterServlet : public HTTPServlet, public IOProcessorImpl { +class InterpreterHTTPServlet : public HTTPServlet, public IOProcessorImpl { public: - InterpreterServlet() {}; - InterpreterServlet(InterpreterImpl* interpreter); - virtual ~InterpreterServlet() {} + InterpreterHTTPServlet() {}; + InterpreterHTTPServlet(InterpreterImpl* interpreter); + virtual ~InterpreterHTTPServlet() {} virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); @@ -78,6 +78,56 @@ protected: }; +class InterpreterWebSocketServlet : public WebSocketServlet, public IOProcessorImpl { +public: + InterpreterWebSocketServlet() {}; + InterpreterWebSocketServlet(InterpreterImpl* interpreter); + virtual ~InterpreterWebSocketServlet() {} + + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("websocket"); + names.insert("http://www.w3.org/TR/scxml/#WebSocketEventProcessor"); + return names; + } + + Data getDataModelVariables(); + virtual void send(const SendRequest& req); + + virtual bool wsRecvRequest(struct evws_connection *conn, const HTTPServer::WSFrame& frame); + + std::string getPath() { + return _path; + } + std::string getURL() { + return _url; + } + void setURL(const std::string& url) { + _url = url; + } + bool canAdaptPath() { + return false; + } + + std::map<std::string, struct evws_connection*>& getRequests() { + return _requests; + } + tthread::recursive_mutex& getMutex() { + return _mutex; + } + +protected: + InterpreterImpl* _interpreter; + + tthread::recursive_mutex _mutex; + std::map<std::string, struct evws_connection*> _requests; + std::string _path; + std::string _url; + +}; + } |