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 import 'package:http_parser/http_parser.dart'; | 5 import 'package:web_socket_channel/web_socket_channel.dart'; |
kevmoo
2016/03/03 00:50:50
sorting?
nweiz
2016/03/03 20:08:22
Done.
| |
6 import 'package:shelf/shelf.dart'; | 6 import 'package:shelf/shelf.dart'; |
7 | 7 |
8 import 'src/web_socket_handler.dart'; | 8 import 'src/web_socket_handler.dart'; |
9 | 9 |
10 /// A typedef used to determine if a function takes two arguments or not. | 10 /// A typedef used to determine if a function takes two arguments or not. |
11 typedef _BinaryFunction(arg1, arg2); | 11 typedef _BinaryFunction(arg1, arg2); |
12 | 12 |
13 /// Creates a Shelf handler that upgrades HTTP requests to WebSocket | 13 /// Creates a Shelf handler that upgrades HTTP requests to WebSocket |
14 /// connections. | 14 /// connections. |
15 /// | 15 /// |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 throw new ArgumentError("If protocols is non-null, onConnection must " | 51 throw new ArgumentError("If protocols is non-null, onConnection must " |
52 "take two arguments, the WebSocket and the protocol."); | 52 "take two arguments, the WebSocket and the protocol."); |
53 } | 53 } |
54 | 54 |
55 var innerOnConnection = onConnection; | 55 var innerOnConnection = onConnection; |
56 onConnection = (webSocket, _) => innerOnConnection(webSocket); | 56 onConnection = (webSocket, _) => innerOnConnection(webSocket); |
57 } | 57 } |
58 | 58 |
59 return new WebSocketHandler(onConnection, protocols, allowedOrigins).handle; | 59 return new WebSocketHandler(onConnection, protocols, allowedOrigins).handle; |
60 } | 60 } |
OLD | NEW |