Ionic 4 chat application and how to send message to particular user?

I created application in Ionic 4, and for backend I use Lumen. Application should have chat page and in that purpose I add Redis, and nodejs. I successfully created public room, and chat between users in that room works. Problem is how to send private message for user, how to initialize users for their private room.

This is how I created public room:

constructor(private socket: Socket) {

        this.getMessages().subscribe(message => {


    getMessages() {
        const observable = new Observable(observer => {
            this.socket.on('message', (data) => {
        return observable;

I send message from Lumen application and Redis:

public function sendMessage()
    $redis = Redis::Connection();
    $sendMessage = json_encode(['user' => 'John Doe', 'text' => 'Some message, text', 'channel' => 'message']);
    $redis->publish('add-message', $sendMessage);

And my node server is:

let express = require('express');
let app = express();
let http = require('http').Server(app);
let redis = require('redis');
let client = redis.createClient("redis://");

let io = require('')(http);

app.use('/', express.static('www'));

http.listen(3000, '', function(){
    console.log('listening on *:3000');

client.on('message', function(chan, msg) {
    let data = JSON.parse(msg);
    io.sockets.emit(, msg);


Bottom line everyone who is subscribed on ‘message’ channel will get message. Problem is that I subscribe user on channel when came to chat page. I don’t know how to subscribe user, and when, on channel where some another user send him message.Also how that sender user to create new room, I suppose to use id of users for room name (per instance user1_user2).

Does anyone know how I can solve this problem? I don’t know even I described well.

Thanks in advance