Closed roqkabel closed 1 year ago
@aikrom
Can you be able to help with this issue?
Would be glad you check this out.
It looks like you didn't boot socket.io.
The code below must be in your provider:
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
export default class AppProvider {
constructor(protected app: ApplicationContract) {}
public async ready() {
if (this.app.environment === 'web') {
await import('../start/socket')
}
}
}
If it doesn't help, create a repository to reproduce the error
okay, let me try this.
Problem statement
I am using AdonisJs with socket.io, and I followed the documentation for using with socket.io
When on the Ws Service Class, using this code provided by the docs does not instantiate the socket and always returns 404 not found /socket.io/ But when I change the socket to use a different port, I was able to connect to the socket.
Actual Results
When using this code works and I am able to connect to socket.io from the client using
ws://localhost:3000
meanwhile app server is running on port3333
Expect Results
From the docs, this code should allow a socket connection.
Package version
AdonisJs Version 5
Node.js and npm version
Node v18.15.0 NPM 9.5.0
Sample Code (to reproduce the issue)