jonataslaw / get_server

A backend server that makes it possible to program with Flutter syntax and reuse existing code
Apache License 2.0
477 stars 42 forks source link

How to set Cookie in websocket ? #48

Open makao007 opened 3 years ago

makao007 commented 3 years ago

Hi, I try to set cookie inside the websocket. But my code doesn't work.

socket.onOpen((ws) {
        context.response.cookie('name', 'hello');
        ws.send('hello');
});
socket.onMessage((message) {
        print (context.request.cookies); // []
});