Angular2-RxJS-Socket.io-chat-application
Angular2-RxJS-Socket.io-chat-application copied to clipboard
something wrong with BehaviorSubject for the socket.io
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 ?
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);