- All Implemented Interfaces:
QtObjectInterface
,QtSignalBlockerInterface
,QtSignalEmitterInterface
,QtThreadAffineInterface
public class QWebSocket extends QObject
Implements a TCP socket that talks the WebSocket protocol
Java wrapper for Qt class QWebSocket
-
Nested Class Summary
Nested classes/interfaces inherited from class io.qt.core.QObject
QObject.MultiSignal, QObject.PrivateSignal0, QObject.PrivateSignal1<A>, QObject.PrivateSignal2<A,B>, QObject.PrivateSignal3<A,B,C>, QObject.PrivateSignal4<A,B,C,D>, QObject.PrivateSignal5<A,B,C,D,E>, QObject.PrivateSignal6<A,B,C,D,E,F>, QObject.PrivateSignal7<A,B,C,D,E,F,G>, QObject.PrivateSignal8<A,B,C,D,E,F,G,H>, QObject.PrivateSignal9<A,B,C,D,E,F,G,H,I>, QObject.QDeclarativeConstructor, QObject.Signal0, QObject.Signal1<A>, QObject.Signal1Default1<A>, QObject.Signal2<A,B>, QObject.Signal2Default1<A,B>, QObject.Signal2Default2<A,B>, QObject.Signal3<A,B,C>, QObject.Signal3Default1<A,B,C>, QObject.Signal3Default2<A,B,C>, QObject.Signal3Default3<A,B,C>, QObject.Signal4<A,B,C,D>, QObject.Signal4Default1<A,B,C,D>, QObject.Signal4Default2<A,B,C,D>, QObject.Signal4Default3<A,B,C,D>, QObject.Signal4Default4<A,B,C,D>, QObject.Signal5<A,B,C,D,E>, QObject.Signal5Default1<A,B,C,D,E>, QObject.Signal5Default2<A,B,C,D,E>, QObject.Signal5Default3<A,B,C,D,E>, QObject.Signal5Default4<A,B,C,D,E>, QObject.Signal5Default5<A,B,C,D,E>, QObject.Signal6<A,B,C,D,E,F>, QObject.Signal6Default1<A,B,C,D,E,F>, QObject.Signal6Default2<A,B,C,D,E,F>, QObject.Signal6Default3<A,B,C,D,E,F>, QObject.Signal6Default4<A,B,C,D,E,F>, QObject.Signal6Default5<A,B,C,D,E,F>, QObject.Signal6Default6<A,B,C,D,E,F>, QObject.Signal7<A,B,C,D,E,F,G>, QObject.Signal7Default1<A,B,C,D,E,F,G>, QObject.Signal7Default2<A,B,C,D,E,F,G>, QObject.Signal7Default3<A,B,C,D,E,F,G>, QObject.Signal7Default4<A,B,C,D,E,F,G>, QObject.Signal7Default5<A,B,C,D,E,F,G>, QObject.Signal7Default6<A,B,C,D,E,F,G>, QObject.Signal7Default7<A,B,C,D,E,F,G>, QObject.Signal8<A,B,C,D,E,F,G,H>, QObject.Signal8Default1<A,B,C,D,E,F,G,H>, QObject.Signal8Default2<A,B,C,D,E,F,G,H>, QObject.Signal8Default3<A,B,C,D,E,F,G,H>, QObject.Signal8Default4<A,B,C,D,E,F,G,H>, QObject.Signal8Default5<A,B,C,D,E,F,G,H>, QObject.Signal8Default6<A,B,C,D,E,F,G,H>, QObject.Signal8Default7<A,B,C,D,E,F,G,H>, QObject.Signal8Default8<A,B,C,D,E,F,G,H>, QObject.Signal9<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default1<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default2<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default3<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default4<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default5<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default6<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default7<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default8<A,B,C,D,E,F,G,H,I>, QObject.Signal9Default9<A,B,C,D,E,F,G,H,I>, QObject.SignalConfiguration
-
Field Summary
Fields Modifier and Type Field Description QObject.Signal0
aboutToClose
QObject.Signal2<QByteArray,@QtPrimitiveType Boolean>
binaryFrameReceived
QObject.Signal1<QByteArray>
binaryMessageReceived
QObject.Signal1<@QtPrimitiveType Long>
bytesWritten
QObject.Signal0
connected
Emitted when a connection is successfully established.QObject.Signal0
disconnected
Emitted when the socket is disconnectedQObject.Signal1<QAbstractSocket.SocketError>
error
QObject.Signal2<@QtPrimitiveType Long,QByteArray>
pong
QObject.Signal1<QSslPreSharedKeyAuthenticator>
preSharedKeyAuthenticationRequired
QObject.Signal2<QNetworkProxy,QAuthenticator>
proxyAuthenticationRequired
QObject.Signal0
readChannelFinished
QObject.Signal1<List<QSslError>>
sslErrors
QObject.Signal1<QAbstractSocket.SocketState>
stateChanged
static QMetaObject
staticMetaObject
This variable stores the meta-object for the class.QObject.Signal2<String,@QtPrimitiveType Boolean>
textFrameReceived
QObject.Signal1<String>
textMessageReceived
-
Constructor Summary
Constructors Modifier Constructor Description QWebSocket()
Overloaded constructor forQWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
protected
QWebSocket(QObject.QDeclarativeConstructor constructor)
Constructor for internal use only.protected
QWebSocket(QtObject.QPrivateConstructor p)
Constructor for internal use only.QWebSocket(String origin)
Overloaded constructor forQWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
QWebSocket(String origin, QWebSocketProtocol.Version version)
Overloaded constructor forQWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
withparent = null
.QWebSocket(String origin, QWebSocketProtocol.Version version, QObject parent)
Creates a new QWebSocket with the given origin, the version of the protocol to use and parent -
Method Summary
Modifier and Type Method Description void
abort()
Aborts the current socket and resets the socket.long
bytesToWrite()
void
close()
Overloaded function forclose(io.qt.websockets.QWebSocketProtocol.CloseCode, java.lang.String)
void
close(QWebSocketProtocol.CloseCode closeCode)
Overloaded function forclose(io.qt.websockets.QWebSocketProtocol.CloseCode, java.lang.String)
withreason = ""
.void
close(QWebSocketProtocol.CloseCode closeCode, String reason)
Gracefully closes the socket with the given closeCode and reasonQWebSocketProtocol.CloseCode
closeCode()
Returns the code indicating why the socket was closedString
closeReason()
Returns the reason why the socket was closedQAbstractSocket.SocketError
error()
String
errorString()
boolean
flush()
void
ignoreSslErrors()
void
ignoreSslErrors(Collection<QSslError> errors)
boolean
isValid()
QHostAddress
localAddress()
short
localPort()
QMaskGenerator
maskGenerator()
long
maxAllowedIncomingFrameSize()
long
maxAllowedIncomingMessageSize()
static long
maxIncomingFrameSize()
static long
maxIncomingMessageSize()
static long
maxOutgoingFrameSize()
void
open(QUrl url)
Opens a WebSocket connection using the given urlvoid
open(QNetworkRequest request)
Opens a WebSocket connection using the given requestString
origin()
Returns the current originlong
outgoingFrameSize()
QAbstractSocket.PauseModes
pauseMode()
QHostAddress
peerAddress()
String
peerName()
short
peerPort()
void
ping()
Overloaded function forping(io.qt.core.QByteArray)
withpayload = new io.qt.core.QByteArray()
.void
ping(QByteArray payload)
Pings the server to indicate that the connection is still alive.QNetworkProxy
proxy()
long
readBufferSize()
QNetworkRequest
request()
Returns the request that was or will be used to open this socketQUrl
requestUrl()
Returns the url the socket is connected to or will connect toString
resourceName()
Returns the name of the resource currently accessedvoid
resume()
long
sendBinaryMessage(QByteArray data)
Sends the given data over the socket as a binary message and returns the number of bytes actually sentlong
sendTextMessage(String message)
Sends the given message over the socket as a text message and returns the number of bytes actually sentvoid
setMaskGenerator(QMaskGenerator maskGenerator)
void
setMaxAllowedIncomingFrameSize(long maxAllowedIncomingFrameSize)
void
setMaxAllowedIncomingMessageSize(long maxAllowedIncomingMessageSize)
void
setOutgoingFrameSize(long outgoingFrameSize)
void
setPauseMode(QAbstractSocket.PauseMode... pauseMode)
Overloaded function forsetPauseMode(io.qt.network.QAbstractSocket.PauseModes)
.void
setPauseMode(QAbstractSocket.PauseModes pauseMode)
void
setProxy(QNetworkProxy networkProxy)
void
setReadBufferSize(long size)
void
setSslConfiguration(QSslConfiguration sslConfiguration)
QSslConfiguration
sslConfiguration()
QAbstractSocket.SocketState
state()
Returns the current state of the socketQWebSocketProtocol.Version
version()
Returns the version the socket is currently usingMethods inherited from class io.qt.core.QObject
blockSignals, childEvent, children, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connectNotify, customEvent, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnectNotify, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, emit, emit, emit, emit, emit, emit, emit, emit, emit, event, eventFilter, findChild, findChild, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, findChildren, inherits, inherits, installEventFilter, isSignalConnected, isWidgetType, isWindowType, killTimer, metaObject, moveToThread, objectName, parent, property, qt_metacast, receivers, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, startTimer, thread, timerEvent, toString, tr, tr, tr
-
Field Details
-
staticMetaObject
This variable stores the meta-object for the class. -
aboutToClose
-
binaryFrameReceived
-
binaryMessageReceived
-
bytesWritten
-
connected
Emitted when a connection is successfully established. A connection is successfully established when the socket is connected and the handshake was successful
-
disconnected
Emitted when the socket is disconnected
-
error
-
pong
-
preSharedKeyAuthenticationRequired
-
proxyAuthenticationRequired
-
readChannelFinished
-
sslErrors
-
stateChanged
-
textFrameReceived
-
textMessageReceived
-
-
Constructor Details
-
QWebSocket
Overloaded constructor for
QWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
withparent = null
. -
QWebSocket
Overloaded constructor for
QWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
with:
version = io.qt.websockets.QWebSocketProtocol.Version.VersionLatest
parent = null
-
QWebSocket
public QWebSocket()Overloaded constructor for
QWebSocket(java.lang.String, io.qt.websockets.QWebSocketProtocol.Version, io.qt.core.QObject)
with:
origin = ""
version = io.qt.websockets.QWebSocketProtocol.Version.VersionLatest
parent = null
-
QWebSocket
Creates a new QWebSocket with the given origin, the version of the protocol to use and parent
-
QWebSocket
Constructor for internal use only.- Parameters:
p
- expected to benull
.
-
QWebSocket
Constructor for internal use only. It is not allowed to call the declarative constructor from inside Java.
-
-
Method Details
-
abort
Aborts the current socket and resets the socket. Unlike close(), this function immediately closes the socket, discarding any pending data in the write buffer
-
bytesToWrite
-
close
Overloaded function for
close(io.qt.websockets.QWebSocketProtocol.CloseCode, java.lang.String)
withreason = ""
. -
close
public final void close()Overloaded function for
close(io.qt.websockets.QWebSocketProtocol.CloseCode, java.lang.String)
with:
closeCode = io.qt.websockets.QWebSocketProtocol.CloseCode.CloseCodeNormal
reason = ""
-
close
Gracefully closes the socket with the given closeCode and reason
See QWebSocket::close(QWebSocketProtocol::CloseCode closeCode, const QString & reason)
-
closeCode
Returns the code indicating why the socket was closed
-
closeReason
Returns the reason why the socket was closed
-
error
-
errorString
-
flush
-
ignoreSslErrors
public final void ignoreSslErrors() -
ignoreSslErrors
-
isValid
-
localAddress
-
localPort
-
maskGenerator
-
maxAllowedIncomingFrameSize
-
maxAllowedIncomingMessageSize
-
open
Opens a WebSocket connection using the given request
-
open
Opens a WebSocket connection using the given url
-
origin
Returns the current origin
-
outgoingFrameSize
-
pauseMode
-
peerAddress
-
peerName
-
peerPort
-
ping
public final void ping()Overloaded function for
ping(io.qt.core.QByteArray)
withpayload = new io.qt.core.QByteArray()
. -
ping
Pings the server to indicate that the connection is still alive. Additional payload can be sent along the ping message
-
proxy
-
readBufferSize
-
request
Returns the request that was or will be used to open this socket
-
requestUrl
Returns the url the socket is connected to or will connect to
-
resourceName
Returns the name of the resource currently accessed
-
resume
-
sendBinaryMessage
Sends the given data over the socket as a binary message and returns the number of bytes actually sent
-
sendTextMessage
Sends the given message over the socket as a text message and returns the number of bytes actually sent
-
setMaskGenerator
-
setMaxAllowedIncomingFrameSize
-
setMaxAllowedIncomingMessageSize
@QtUninvokable public final void setMaxAllowedIncomingMessageSize(long maxAllowedIncomingMessageSize) -
setOutgoingFrameSize
-
setPauseMode
Overloaded function for
setPauseMode(io.qt.network.QAbstractSocket.PauseModes)
. -
setPauseMode
-
setProxy
-
setReadBufferSize
-
setSslConfiguration
-
sslConfiguration
-
state
Returns the current state of the socket
-
version
Returns the version the socket is currently using
-
maxIncomingFrameSize
public static long maxIncomingFrameSize() -
maxIncomingMessageSize
public static long maxIncomingMessageSize() -
maxOutgoingFrameSize
public static long maxOutgoingFrameSize()
-