# All files / websockets observable-socket.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    171x

    1x

    3x
    3x

    3x

     import { ReplaySubject, Subject } from 'rxjs';
    import { ObservableSocketServer } from './interfaces/observable-socket-server.interface';

    export class ObservableSocket {
      public static create<T = any>(server: T): ObservableSocketServer<T> {
        const init = new ReplaySubject<T>();
        init.next(server);

        return {
          init,
          connection: new Subject(),
          disconnect: new Subject(),
          server,
        };
      }
    }