Angular2-RxJS-Socket.io-chat-application icon indicating copy to clipboard operation
Angular2-RxJS-Socket.io-chat-application copied to clipboard

something wrong with BehaviorSubject for the socket.io

Open helxsz opened this issue 8 years ago • 1 comments

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<Sensor> = new BehaviorSubject<Sensor>(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 ?

helxsz avatar Oct 28 '16 11:10 helxsz

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);

reneszabo avatar Oct 29 '16 20:10 reneszabo