SocketIO Issue: Emit and On Message not working using ng-socket-io


I am working on Real Time chat app using and NodeJs Server, I am have successfully configured the Socket Modul and now able to connect and get live users. I have added SocketIoModule in app.module.ts without configuration and I am configuring that in a service like this

const config: SocketIoConfig = {
    url: '',
    options: {
        query: {
            'platform': 'somePlatform',
            'apiUrl': 'someURL',
            'clientId': clientId,
            'clientSecret': clientSecret,
            'Content-Type': "application/json",

export class ChatServiceProvider extends Socket {
    token: any;
    constructor() {
        console.log('token', UserInfoProvider.token);
        config['options']['query']['Authorization'] = 'Bearer ' + UserInfoProvider.token;
        console.log('COnfig', config);

and injected that service into my chat page constructor. now I am calling a function which connecting and getting live users successfully following is my code

constructor(public socket: ChatServiceProvider){}

 this.socket.on('connect', () => {
          this.socket.emit('handshake', response);
          this.socket.on('live', (data) => {
            console.log('LIVE', data);
          this.socket.on('operator', (data) => {
            console.log('OPERATOR', data);
            this.agents = data;

          this.socket.on('error', (data) => {
            console.log('ERROR', data);

          this.socket.on('message', msg => {
            console.log('NewMessage', msg);


in Above code I am able to connect and listen for live users but unable to receive new messages same is the case for emitting the message that is also not working

this.socket.emit("message", msgdata);

can someone please guide me what I am doing wrong any help appreciated.