Commit 9e0b4d1e authored by armin's avatar armin
Browse files

iremoved specil ios case as it now works

parent ae908aa2
......@@ -53,10 +53,10 @@ void MeteorDDP::init( const QString &pUri )
connect( &mWebsocket, &QWebSocket::connected, this, &MeteorDDP::onConnected, Qt::UniqueConnection );
connect( &mWebsocket, &QWebSocket::disconnected, this, &MeteorDDP::ddpDisconnected );
connect( this, &MeteorDDP::sendMessageSignal, this, &MeteorDDP::sendJson, Qt::UniqueConnection );
connect( &mWebsocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
[=](QAbstractSocket::SocketError error){
qDebug()<<mWebsocket.errorString();
});
connect( &mWebsocket, QOverload<QAbstractSocket::SocketError>::of( &QWebSocket::error ),
[ = ]( QAbstractSocket::SocketError error ) {
qDebug() << mWebsocket.errorString();
} );
mWebsocket.open( wsUri );
QDateTime now = QDateTime::currentDateTime();
......@@ -231,46 +231,32 @@ void MeteorDDP::sendRequest( const QSharedPointer<DDPRequest> &pDdpRequest )
void MeteorDDP::resume()
{
qDebug() << "resuming ddp";
#if defined(Q_OS_ANDROID) || defined(Q_OS_LINUX) ||defined(Q_OS_WIN)
qDebug() << "websocket valid: " << mWebsocket.isValid();
QUrl wsUri = QUrl( QStringLiteral( "wss://" ) + mWebsocketUri + QStringLiteral( "/websocket" ) );
if ( mWebsocket.state() == QAbstractSocket::UnconnectedState ) {
qDebug() << "websocket valid: " << mWebsocket.isValid();
QUrl wsUri = QUrl( QStringLiteral( "wss://" ) + mWebsocketUri + QStringLiteral( "/websocket" ) );
if ( mWebsocket.state() == QAbstractSocket::UnconnectedState ) {
mWebsocket.open( wsUri );
} else if ( mWebsocket.state() != QAbstractSocket::ConnectingState ) {
auto const connection = new QMetaObject::Connection;
*connection = connect( &mWebsocket, &QWebSocket::disconnected, [ = ]() {
qDebug() << "websocket closed";
mWebsocket.open( wsUri );
} else if ( mWebsocket.state() != QAbstractSocket::ConnectingState ) {
auto const connection = new QMetaObject::Connection;
*connection = connect( &mWebsocket, &QWebSocket::disconnected, [ = ]() {
qDebug() << "websocket closed";
mWebsocket.open( wsUri );
QDateTime now = QDateTime::currentDateTime();
uint currentTime = now.toTime_t();
mLastPing = currentTime;
if ( connection != nullptr ) {
QObject::disconnect( *connection );
delete connection;
}
} );
mWebsocket.close();
}
if ( mWebsocket.state() == QAbstractSocket::UnconnectedState ) {
// connectWithServer();
}
QDateTime now = QDateTime::currentDateTime();
uint currentTime = now.toTime_t();
mLastPing = currentTime;
#else
qDebug() << "resuming ddp";
mWebsocket.close();
connect(&mWebsocket , &QWebSocket::disconnected, [&]() {
qDebug()<<"disconnected";
init( mWebsocketUri );
if ( connection != nullptr ) {
QObject::disconnect( *connection );
delete connection;
}
} );
mWebsocket.close();
}
#endif
if ( mWebsocket.state() == QAbstractSocket::UnconnectedState ) {
// connectWithServer();
}
}
void MeteorDDP::unsetResponseBinding( const QString &pId )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment