drogonframework / drogonframework/drogon

WebSocketController Question

Open
#2,238 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 12h
Merged PRs (30d)
15

Description

I'm 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.