Support upgrading requests from the adapter#90
Conversation
|
Hi @Kyiro Thanks for the PR. I'll take a look later! |
|
Hi @Kyiro, This looks good. Using First, could you write proper tests for this implementation? Second, while it's not necessary to include in this PR, I think passing app.get('/', (c) => {
const ip = c.env.incoming.socket.remoteAddress;
return c.text(`You are accessing from ${ip}`);
}) |
|
I wanted to write tests but the types fail for some reason. |
|
Ah, there's a type mismatch. But could you still push the tests, even if they fail? |
|
Yeah, I guess but I don't have a way to test the tests. I'll see later |
|
|
||
| export const createAdaptorServer = (options: Options): ServerType => { | ||
| const fetchCallback = options.fetch | ||
| const upgrade = options.upgrade !== false |
There was a problem hiding this comment.
This would always add the upgrade listener unless it is actively set to false. Is this intended?
There was a problem hiding this comment.
Yes, idk if it should be the default or not so i made it the default
These changes allow the upgrading to something like WebSockets from within Hono itself. Feel free to request any changes or even deny this PR as I'm not sure if it fits. The only big issue is that I don't think it supports HTTP2 at all.