enaukkarinen / Angular2-RxJS-Socket.io-chat-application

17 stars 8 forks source link

something wrong with BehaviorSubject for the socket.io #1

Open helxsz opened 7 years ago

helxsz commented 7 years ago

Hi, I reused part of your code from https://github.com/enaukkarinen/Angular2-RxJS-Socket.io-chat-application/blob/master/src/app/components/messaging/message.service.ts

` newMessage: Subject = new BehaviorSubject(null);

 this.newMessage.next(new Message(JSON.parse(msg)));

` But I got one error saying

Supplied parameters do not match any signature of call target. and one error saying undefined object because of newMessage is null

any ideas how to solve it ?

reneszabo commented 7 years ago

You need an object Type ... it can be Message Object or anything you like ... like ( string, number, any ) newMessage: Subject<Message> = new BehaviorSubject<Message>(null);