go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

how do u do cookie sessions or cookies data sending in coap?

Open hiqsociety opened this issue 3 years ago • 3 comments

how do u do cookie sessions or cookies data sending in coap?

any example on this? pls dont suggest use etag?

hiqsociety avatar Oct 16 '22 19:10 hiqsociety

It depends on how big the cookie is. If it's a few bytes, you can use option URI-Query (max 255 bytes) with value "cookie=[data]" - all data must be string format. In this case, first you need to transfer the cookie to the server via the body and then the server needs to associate it with the socket. After that, for each request from a client, the server appends stored cookie.

jkralik avatar Oct 17 '22 06:10 jkralik

  1. what if it's not just a few bytes just wondering.
  2. also, what's a good way to do this cookie? since everything is "new", was wondering if there are better options for this cookie thing.

kolinfluence avatar Oct 17 '22 22:10 kolinfluence

  1. 255 Bytes with keyword
  2. Only if you need to forward cookie: You need to create a session at the server size and associate cookie there. Similar as is mentioned in OCF Specification - Sign in operation via oic/sec/session resource. And after that you will append this cookie to any request from the client to server.

jkralik avatar Oct 29 '22 17:10 jkralik