OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library shelf_web_socket.web_socket_handler; | |
6 | |
7 import 'dart:convert'; | 5 import 'dart:convert'; |
8 | 6 |
9 import 'package:http_parser/http_parser.dart'; | 7 import 'package:http_parser/http_parser.dart'; |
10 import 'package:shelf/shelf.dart'; | 8 import 'package:shelf/shelf.dart'; |
11 | 9 |
12 /// A class that exposes a handler for upgrading WebSocket requests. | 10 /// A class that exposes a handler for upgrading WebSocket requests. |
13 class WebSocketHandler { | 11 class WebSocketHandler { |
14 /// The function to call when a request is upgraded. | 12 /// The function to call when a request is upgraded. |
15 final Function _onConnection; | 13 final Function _onConnection; |
16 | 14 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 <html> | 124 <html> |
127 <head><title>$title</title></head> | 125 <head><title>$title</title></head> |
128 <body> | 126 <body> |
129 <h1>$title</h1> | 127 <h1>$title</h1> |
130 <p>$message</p> | 128 <p>$message</p> |
131 </body> | 129 </body> |
132 </html> | 130 </html> |
133 """, headers: {'content-type': 'text/html'}); | 131 """, headers: {'content-type': 'text/html'}); |
134 } | 132 } |
135 } | 133 } |
OLD | NEW |