I have successfully installed socket.io-client
in my Angular 5.2 application, but after trying to connect (which has worked flawlessly in the past), I am encountering a strange error.
TypeError: socket_io_client_1.default is not a function
at new AuthService (auth.service.ts:15)
at _createClass (core.js:10891)
at _createProviderInstance$1 (core.js:10865)
at resolveNgModuleDep (core.js:10850)
at NgModuleRef_.get (core.js:12087)
at resolveDep (core.js:12577)
at createClass (core.js:12439)
at createDirectiveInstance (core.js:12284)
at createViewNodes (core.js:13742)
at callViewAction (core.js:14176)
This error occurs on line 15 of the AuthService
file.
import {Injectable} from '@angular/core';
import io from 'socket.io-client';
import {CookieService} from 'ngx-cookie-service';
@Injectable()
export class AuthService {
socket;
domain = 'http://localhost:3000';
isUserLoggedIn = false;
cookie_key = '';
user = {};
constructor(private cookieService: CookieService) {
this.socket = io(this.domain);
}
I am completely stumped by this issue. Any help or suggestions would be greatly appreciated.