realm / realm-graphql-service

GraphQL service for Realm Object Server
https://realm.io
Apache License 2.0
43 stars 10 forks source link

Invalid subscriptionHandler path matching #73

Closed oleastre closed 6 years ago

oleastre commented 6 years ago

Internally, realm-object-server handles paths for HTTP Upgrade in a different way than other paths; it uses path-to-regexp to match upgrade paths. The current @Upgrade("/*") defined for websocket connections is then invalid in the path-to-regexp sense. It could probably be replaced by @Upgrade("/(.*)") but this does not work neither as ros uses URI.joinPaths that transforms the * character in %2A.

The best solution I found to work around those problems without modifying ROS, is to use @Upgrade("/:path+") and modify the handler to create the realm path from the parsed parameters.

Attached patch should solve that issue. (I don't have a cloned repo with the expected changes in github for now)

0001-Correct-path-mathing-string-for-the-websocket-connec.patch.txt

nirinchev commented 6 years ago

Thanks for reporting this - looks like an oversight that I hope to take a look at later today.

nirinchev commented 6 years ago

I've released version 3.2.1 which should address this. Let me know if that works for you!

oleastre commented 6 years ago

Seems to work as expected. Thanks for the quick fix.