response messagepack
Gerasimos (Makis) Maropoulos edited this page Aug 7, 2020
·
1 revision
Pages 72
- What is Iris
-
📌 Getting Started - Host
- Configuration
- Routing
- HTTP Method Override
- API Versioning
- Content Negotiation
- Response Recorder
- HTTP Referrer
- Request Authentication
- URL Query Parameters
- Forms
- Model Validation
- Cache
- View
- Cookies
- Sessions
- Websockets
- Dependency Injection
- MVC
- gRPC
- Sitemap
- Localization
- Testing
-
🤓 Resources
Clone this wiki locally
Content-Type: "application/msgpack"
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves. https://msgpack.org
The Context.MsgPack(v) is the method which sends MessagePack responses to the client. It accepts any Go value. As always, if it's a struct value, the fields should be exported.
type Data struct {
Message string `msgpack:"message"`
}
func handler(ctx iris.Context) {
response := Data{Message: "a message"}
ctx.MsgPack(response)
}Result
\x81\xa7message\xa9a message
Home | Project | Quick Start | Technical Docs | Copyright © 2019-2020 Gerasimos Maropoulos. Documentation terms of use.