-
-
Notifications
You must be signed in to change notification settings - Fork 84
Adds support for routing #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you restore the previous linting? We use standard with no semicolons. The same applies to README.
Also, can you split the test file? I think it's getting too big.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, really nice feature ^^
As a side note, maybe we should also add a note that for asynchronous operations inside of an EventListener it is better to use a Promise with preferably a .catch() and a .finally() on compatible environments to avoid any potential memory leaks when something goes wrong (using async/await within .on('listener') isn't a good idea basically).
Co-Authored-By: Andrew Wong <andrew12345@live.com>
|
Can you please bump the dependency to Fastify v2.4.1? That has the fix you need. |
|
OK, I’ll do ASAP! |
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit
Eomm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this setup:
fastify.register(require('./'), {
handle,
options: { maxPayload: 1048576 }
})
fastify.get('/', { websocket: true }, (connection, req) => {
connection.socket.on('message', message => {
// message === 'hi from client'
connection.socket.send('hi from server')
})
})
Should we throw an error?
Co-Authored-By: Manuel Spigolon <behemoth89@gmail.com>
I don't understand your point. Can you elaborate, please? |
Co-Authored-By: Manuel Spigolon <behemoth89@gmail.com>
Yeah sorry. In that case, I set up a global handler and a route handler at the same endpoint. The server starts correctly and when I connect to it with So I'm wondering if it the case to throw an "already declared" error. WDYT? |
OK. I think there is a misconception about "global" handler: it is a handler that is called when no more specific routes are defined. If you don't defined it, the plugin provides the "404 WS" response for you. I think that what you did is the correct behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read better the docs and it is written, thank you for the explanation.
As you pointed I suggested the spaces
Great feature 👍 Thank you
Co-Authored-By: Manuel Spigolon <behemoth89@gmail.com>
Nice! |
|
Snap, there is a conflict in README. @Eomm could you reslove it? Just use your suggestion. |
|
Any news on merging this? |
|
Releasing later today or at least tomorrow if anybody can't do it before 👍🏼 |
This PR adds support for routing to this plugin. Uses:
All the old functionalities are still working.