jonataslaw / get_server

A backend server that makes it possible to program with Flutter syntax and reuse existing code
Apache License 2.0
475 stars 43 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); // []
});