Comments (5)
Request contains client that provides call NewMessage
.
Eg:
req.Client.NewMessage(coap.MessageParams{
Type: NonConfirmable,
...
})
Is it helps you?
from go-coap.
Yes, that would help. Thanks!
from go-coap.
Shouldn't coap.ResponseWriter.WriteMsg
if there's no ACK of a CON message?
I'm running the observe client/server example like so:
server/main.go:
....
func sendResponse(w coap.ResponseWriter, req *coap.Request, subded time.Time) error {
resp := req.Client.NewMessage(coap.MessageParams{
Type: coap.Confirmable,
Code: coap.Content,
})
resp.SetOption(coap.ContentFormat, coap.TextPlain)
resp.SetObserve(5)
resp.SetPayload([]byte(fmt.Sprintf("Been running for %v", time.Since(subded))))
return w.WriteMsg(resp)
}
...
from go-coap.
But i think you need to set Token and MessageId(for udp) because the client cannot pair notification..... something like:
func sendResponse(w coap.ResponseWriter, req *coap.Request, subded time.Time) error {
resp := req.Client.NewMessage(coap.MessageParams{
Type: coap.Confirmable,
Code: coap.Content,
MessageID: req.Msg.MessageID(),
Token: req.Msg.Token(),
})
resp.SetOption(coap.ContentFormat, coap.TextPlain)
resp.SetObserve(5)
resp.SetPayload([]byte(fmt.Sprintf("Been running for %v", time.Since(subded))))
return w.WriteMsg(resp)
}
...
from go-coap.
I will close this issue. Please if you have still problem please reopen it. Thx
from go-coap.
Related Issues (20)
- go install issue - go.mod has post-v3 module path at revision v3.0.0 HOT 1
- how do i do the tls / letsencrypt equivalent of a secure connection? HOT 1
- how do u do cookie sessions or cookies data sending in coap? HOT 3
- How to get IdentityHint for request HOT 2
- TCP doesn't work HOT 2
- Bidirectional examples missing HOT 2
- mux.Router can't handle root path or no path ("/") HOT 3
- Move from `pion/udp` to `pion/transport` HOT 3
- Support for Middlewares in mux Router HOT 5
- Consume `pion/dtls` connection ID support HOT 1
- Support serializing and deserializing a UDP DTLS connection HOT 2
- Implement Support for Separate Messages in Server HOT 1
- Server response with ACK to Empty CON (CoAP Ping) HOT 1
- /examples/dtls/cid/server crashes if client has wrong PSK HOT 1
- udp/server_test.go fails if first non-loopback interface is not running HOT 2
- Media type strings do not match IANA registry HOT 5
- Mux provides user with internal map HOT 1
- Ping (CON Empty Message) Notifications HOT 1
- Support for sending messages without token
- Blockwise requests should be correlated based on message options HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-coap.