Lines Matching refs:WebSocket

33 #include "modules/websockets/WebSocket.h"
128 const char* WebSocket::subProtocolSeperator()
133 WebSocket::WebSocket(ScriptExecutionContext* context)
145 WebSocket::~WebSocket()
151 PassRefPtr<WebSocket> WebSocket::create(ScriptExecutionContext* context)
153 RefPtr<WebSocket> webSocket(adoptRef(new WebSocket(context)));
158 PassRefPtr<WebSocket> WebSocket::create(ScriptExecutionContext* context, const String& url, ExceptionState& es)
161 return WebSocket::create(context, url, protocols, es);
164 PassRefPtr<WebSocket> WebSocket::create(ScriptExecutionContext* context, const String& url, const Vector<String>& protocols, ExceptionState& es)
171 RefPtr<WebSocket> webSocket(adoptRef(new WebSocket(context)));
181 PassRefPtr<WebSocket> WebSocket::create(ScriptExecutionContext* context, const String& url, const String& protocol, ExceptionState& es)
185 return WebSocket::create(context, url, protocols, es);
188 void WebSocket::connect(const String& url, ExceptionState& es)
194 void WebSocket::connect(const String& url, const String& protocol, ExceptionState& es)
201 void WebSocket::connect(const String& url, const Vector<String>& protocols, ExceptionState& es)
203 LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data());
207 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Invalid url for WebSocket " + m_url.elidedString());
214 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Wrong url scheme for WebSocket " + m_url.elidedString());
226 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket port " + String::number(m_url.port()) + " blocked");
248 // FIXME: There is a disagreement about restriction of subprotocols between WebSocket API and hybi-10 protocol
254 // comply with WebSocket API specification, but it seems to be the only reasonable way to handle this conflict.
257 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Wrong protocol for WebSocket '" + encodeProtocolString(protocols[i]) + "'");
266 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket protocols contain duplicates: '" + encodeProtocolString(protocols[i]) + "'");
281 void WebSocket::handleSendResult(WebSocketChannel::SendResult result, ExceptionState& es)
285 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket message contains invalid character(s).");
289 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket send() failed.");
297 void WebSocket::updateBufferedAmountAfterClose(unsigned long payloadSize)
302 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket is already in CLOSING or CLOSED state.");
305 void WebSocket::send(const String& message, ExceptionState& es)
307 LOG(Network, "WebSocket %p send() Sending String '%s'", this, message.utf8().data());
321 void WebSocket::send(ArrayBuffer* binaryData, ExceptionState& es)
323 LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData);
337 void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& es)
339 LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arrayBufferView);
354 void WebSocket::send(Blob* binaryData, ExceptionState& es)
356 LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData->url().elidedString().utf8().data());
370 void WebSocket::close(unsigned short code, const String& reason, ExceptionState& es)
375 void WebSocket::close(ExceptionState& es)
380 void WebSocket::close(unsigned short code, ExceptionState& es)
385 void WebSocket::closeInternal(int code, const String& reason, ExceptionState& es)
388 LOG(Network, "WebSocket %p close() without code and reason", this);
390 LOG(Network, "WebSocket %p close() code=%d reason='%s'", this, code, reason.utf8().data());
397 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket close message is too long.");
407 m_channel->fail("WebSocket is closed before the connection is established.", WarningMessageLevel);
415 const KURL& WebSocket::url() const
420 WebSocket::State WebSocket::readyState() const
425 unsigned long WebSocket::bufferedAmount() const
430 String WebSocket::protocol() const
435 String WebSocket::extensions() const
440 String WebSocket::binaryType() const
452 void WebSocket::setBinaryType(const String& binaryType)
465 const AtomicString& WebSocket::interfaceName() const
470 ScriptExecutionContext* WebSocket::scriptExecutionContext() const
475 void WebSocket::contextDestroyed()
477 LOG(Network, "WebSocket %p contextDestroyed()", this);
483 bool WebSocket::canSuspend() const
488 void WebSocket::suspend(ReasonForSuspension)
494 void WebSocket::resume()
500 void WebSocket::stop()
516 void WebSocket::didConnect()
518 LOG(Network, "WebSocket %p didConnect()", this);
528 void WebSocket::didReceiveMessage(const String& msg)
530 LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this, msg.utf8().data());
537 void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
539 LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size()));
558 void WebSocket::didReceiveMessageError()
560 LOG(Network, "WebSocket %p didReceiveMessageError()", this);
565 void WebSocket::didUpdateBufferedAmount(unsigned long bufferedAmount)
567 LOG(Network, "WebSocket %p didUpdateBufferedAmount() New bufferedAmount is %lu", this, bufferedAmount);
573 void WebSocket::didStartClosingHandshake()
575 LOG(Network, "WebSocket %p didStartClosingHandshake()", this);
579 void WebSocket::didClose(unsigned long unhandledBufferedAmount, ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason)
581 LOG(Network, "WebSocket %p didClose()", this);
598 EventTargetData* WebSocket::eventTargetData()
603 EventTargetData* WebSocket::ensureEventTargetData()
608 size_t WebSocket::getFramingOverhead(size_t payloadSize)