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 pub.barback.admin_server; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 import 'dart:io'; | 6 import 'dart:io'; |
9 | 7 |
10 import 'package:http_parser/http_parser.dart'; | 8 import 'package:http_parser/http_parser.dart'; |
11 import 'package:shelf/shelf.dart' as shelf; | 9 import 'package:shelf/shelf.dart' as shelf; |
12 import 'package:shelf_web_socket/shelf_web_socket.dart'; | 10 import 'package:shelf_web_socket/shelf_web_socket.dart'; |
13 | 11 |
14 import '../io.dart'; | 12 import '../io.dart'; |
15 import '../log.dart' as log; | 13 import '../log.dart' as log; |
16 import 'asset_environment.dart'; | 14 import 'asset_environment.dart'; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 60 |
63 /// Creates a web socket for [request] which should be an upgrade request. | 61 /// Creates a web socket for [request] which should be an upgrade request. |
64 void _handleWebSocket(CompatibleWebSocket socket) { | 62 void _handleWebSocket(CompatibleWebSocket socket) { |
65 _webSockets.add(socket); | 63 _webSockets.add(socket); |
66 var api = new WebSocketApi(socket, environment); | 64 var api = new WebSocketApi(socket, environment); |
67 api.listen() | 65 api.listen() |
68 .whenComplete(() => _webSockets.remove(api)) | 66 .whenComplete(() => _webSockets.remove(api)) |
69 .catchError(addError); | 67 .catchError(addError); |
70 } | 68 } |
71 } | 69 } |
OLD | NEW |