We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried this (see below) but can't get the connection event to trigger.
'use strict' const serverlessExpress = require('@codegenie/serverless-express'); const app = require('./app'); const server = serverlessExpress.createServer(app) const {initWebSocket} = require('./ws'); initWebSocket(server); exports.handler = (event, context) => { serverlessExpress.proxy(server, event, context); };
const WebSocket = require('ws'); function initWebSocket(server) { const wss = new WebSocket.Server({server}); wss.on('connection', (ws) => { console.error('*** connection ****'); ws.on('message', (message) => { console.error(`Received message: ${message}`); ws.send(`Echo: ${message}`); }); ws.on('close', () => { console.error('user disconnected'); }); ws.on('error', (error) => { console.error('WebSocket error:', error); }); ws.send('Welcome to the WebSocket server!'); }); } module.exports = { initWebSocket };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried this (see below) but can't get the connection event to trigger.
The text was updated successfully, but these errors were encountered: