plgd-dev / go-coap

Implementation of CoAP Server & Client in Go

Home Page:https://coap.technology

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

hiqsociety opened this issue · comments

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

any example on this? pls dont suggest use etag?

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.

  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.
  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.