-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
bugSomething isn't workingSomething isn't workingneeds investigationSomething that needs to be looked atSomething that needs to be looked at
Description
Code:
// main.ts
import { Application, Router } from '@oak/oak';
const router = new Router();
router.get('/wss', (context) => {
const socket = context.upgrade();
socket.onmessage = (event) => {
console.log(event.data);
socket.send('Hello, WebSocket! [Server]');
};
});
router.get('/', (context) => {
context.response.body = `
<h1>Hello, Oak!</h1>
<script>
const ws = new WebSocket('ws://localhost:8000/wss');
ws.onopen = () => {
console.log('WebSocket connection established!');
ws.send('Hello, WebSocket!');
};
ws.onmessage = (event) => {
console.log(event.data);
};
</script>
`;
context.response.type = 'text/html';
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
export default { fetch: app.fetch };deno serve main.ts
Expected Result:
Success
Actual Result:
deno serve: Listening on http://0.0.0.0:8000/
Upgrade response was not returned from callbackNote:
This works correctly when using Hono and following their Deno instructions:
savicheema
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds investigationSomething that needs to be looked atSomething that needs to be looked at
