//! [onNewConnection] void SslEchoServer::onNewConnection() { QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection(); qDebug() << "Client connected:" << pSocket->peerName() << pSocket->origin(); connect(pSocket, SIGNAL(textMessageReceived(QString)), this, SLOT(processMessage(QString))); connect(pSocket, SIGNAL(binaryMessageReceived(QByteArray)), this, SLOT(processBinaryMessage(QByteArray))); connect(pSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); //connect(pSocket, SIGNAL(pong(quint64)), this, SLOT(processPong(quint64))); m_clients << pSocket; }
//! [onNewConnection] void SslEchoServer::onNewConnection() { QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection(); qDebug() << "Client connected:" << pSocket->peerName() << pSocket->origin(); connect(pSocket, &QWebSocket::textMessageReceived, this, &SslEchoServer::processTextMessage); connect(pSocket, &QWebSocket::binaryMessageReceived, this, &SslEchoServer::processBinaryMessage); connect(pSocket, &QWebSocket::disconnected, this, &SslEchoServer::socketDisconnected); //connect(pSocket, &QWebSocket::pong, this, &SslEchoServer::processPong); m_clients << pSocket; }