ngx-socket-io
ngx-socket-io copied to clipboard
forceNew config option not supported
Using Angular 12 / Typescript.
The SocketIOConfig interface does not support a forceNew option. This results in a compile-time error when attempting to use it due to a type assignment failure.
If it helps, I faced a similar issue where I had to use withCredential option. I downgraded to use the 4.0.0 version which was before the SocketIoConfig fixed interface was implemented and it works for me.
Same here. I was just upgrading my server and client to latest versions and received that error. After downgrading to 4.0.0 it is working again. Thanks.
I faced the same problem but couldn't downgrade because in my case I need angular 15. So for anyone in this case you can just add this in the declaration of the class SocketIoConfig in the file locate in \node_modules\ngx-socket-io\src\config\socket-io.config.d.ts
export interface SocketIoConfig {
url: string;
/**
* Options
* References:
* https://github.com/socketio/socket.io-client/blob/master/docs/API.md#new-managerurl-options
*/
options?: {
/**
* Name of the path that is captured on the server side. Default: /socket.io
*/
path?: string;
//....
forceNew?: boolean
};
}
This will allow you to use the forceNew option. I know this is not a long-term fix but it might do the trick before authors fix the problem.