We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
Is there a way to setup WebSocket listeners along with http requests?
The text was updated successfully, but these errors were encountered:
import 'dart:async'; import 'package:functions_framework/functions_framework.dart'; import 'package:shelf/shelf.dart'; import 'package:shelf_router/shelf_router.dart'; import 'package:shelf_web_socket/shelf_web_socket.dart'; /// ./server.exe @CloudFunction() FutureOr<Response> function(Request request) async { final app = Router(); app.get('/', (Request request) { return Response.ok('root'); }); return app(request); } @CloudFunction() FutureOr<Response> webSocket(Request request) async { var app = Router(); var wsHandle = webSocketHandler((webSocket) { webSocket.stream.listen((message) { print(message); webSocket.sink.add('echo $message'); }); }); app.get('/', wsHandle); return app(request); }
./bin/server.exe --target=webSocket
Connect in localhost:8080
localhost:8080
Sorry, something went wrong.
No branches or pull requests
Hi,
Is there a way to setup WebSocket listeners along with http requests?
The text was updated successfully, but these errors were encountered: