1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SERVER_WEB_SOCKET_H_
6 #define NET_SERVER_WEB_SOCKET_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_piece.h"
18 class HttpServerRequestInfo
;
19 class WebSocketEncoder
;
21 class WebSocket final
{
30 static WebSocket
* CreateWebSocket(HttpServer
* server
,
31 HttpConnection
* connection
,
32 const HttpServerRequestInfo
& request
);
34 void Accept(const HttpServerRequestInfo
& request
);
35 ParseResult
Read(std::string
* message
);
36 void Send(const std::string
& message
);
40 WebSocket(HttpServer
* server
,
41 HttpConnection
* connection
,
42 const HttpServerRequestInfo
& request
);
44 HttpServer
* const server_
;
45 HttpConnection
* const connection_
;
46 scoped_ptr
<WebSocketEncoder
> encoder_
;
47 std::string response_extensions_
;
50 DISALLOW_COPY_AND_ASSIGN(WebSocket
);
55 #endif // NET_SERVER_WEB_SOCKET_H_