Skip to content
New issue

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

has anyone found a workaround for using SocketIO? #299

Open
builder7777 opened this issue Apr 20, 2020 · 3 comments
Open

has anyone found a workaround for using SocketIO? #299

builder7777 opened this issue Apr 20, 2020 · 3 comments

Comments

@builder7777
Copy link

The documentation gives an example of using socketio, but using it throws an error:

import { Server, SocketIO } from 'mock-socket';

Module '"mock-socket"' has no exported member 'SocketIO'.

I realize this repo seems to have been abandoned, but does anyone have a usable workaround?

@pickworth
Copy link

the type defs are out of date, stick this in your code:

declare module 'mock-socket' {
  type SocketIO = any
}

you can do better than just using any, if you want.

@Mnigos
Copy link

Mnigos commented Jul 7, 2021

I got that error now
'SocketIO' only refers to a type, but is being used as a value here.

@ronyf
Copy link

ronyf commented Jan 16, 2022

class SocketIO {
    constructor(uri: string, opts?: any);
    close: () => void;
    disconnect: () => void;
    emit: (event: string) => SocketIO;
    send: (data: any) => SocketIO;
    on: (type: string, callback: (data: any) => void) => SocketIO;
    off: (type: string, callback: (data: any) => void) => SocketIO;
    hasListeners: (type: string) => boolean;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants