admin管理员组

文章数量:1124532

I'm using the excellent Drogon C++ Web Framework and having difficulty figuring out how to create a dynamic route, i.e. on the fly as the app is running, for a custom WebSocketController instance.

I want to spin up an instance of the custom web-socket controller with a path determined at run time. It is straightforward to create a web-socket controller when we know the paths in advance but seems to be anything but straightforward for the dynamic case.

It is possible there is a better way to handle this and I am looking for anyone that may of implemented the dynamic case.

I thought I had a solution but I get a runtime assert in the app().run() method for the variable routersInit_ and I don't see anywhere in the framework where this variable gets set to true, so it is very confusing.

Thanks

Created a custom web-socket controller. Removed the ADD_PATH macros. Added a custom registerSelf__(path, {}); within the constructor of the custom web-socket controller.

本文标签: Drogon C Web FrameworkWebSocketController QuestionStack Overflow