Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.6k
MessagePack Format
This page has moved to docs.servicestack.net/messagepack-format
Message Pack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON but it's faster and smaller.
If you ever wished to use JSON for convenience (e.g. storing an image with metadata) but could not for technical reasons (encoding, size, speed...), MessagePack offers a great replacement. Despite the name it ends up being a much better "Binary JSON" than BSON is, as it's much faster, smaller and doesn't require the foreign types like "ObjectId", "UUID" that BSON has.
MsgPack is a great addition to your ServiceStack's web services as it has similar performance to Protocol Buffers (.NET's fastest binary serializer) but is also schema-less like JSON so already works with your Un-Attributed, Clean POCOs - no code-changes required. (as opposed to Protobuf format which requires decorating every serializable property with [DataMember(Order=N)]).
Message Pack is easily installed with the ServiceStack.MsgPack NuGet package:
Install-Package ServiceStack.MsgPack
After the NuGet Package is added to your Project, enable the MsgPack format with:
Plugins.Add(new MsgPackFormat());
The NuGet plugin also includes the MsgPackServiceClient client below so you can easily call it from any C# Client.
Just like the rest of ServiceStack C# Clients, MsgPackServiceClient is interchangeable with the other clients that equally supports all your ServiceStack's services including the New API Design, e.g:
varclient=newMsgPackServiceClient(BaseUri);List<Todo>all=client.Get(newTodos());// Count = 0vartodo=client.Post(newTodo{Content="New TODO",Order=1});// todo.Id = 1all=client.Get(newTodos());// Count = 1todo.Content="Updated TODO";todo=client.Put(todo);// todo.Content = Updated TODOclient.Delete(newTodos(todo.Id));all=client.Get(newTodos());More examples of using MsgPackServiceClient can be found in the New APIs Integration Test Suite.
- Why ServiceStack?
- Important role of DTOs
- What is a message based web service?
- Advantages of message based web services
- Why remote services should use separate DTOs
Getting Started
Designing APIs
Reference
Clients
Formats
View Engines 4. Razor & Markdown Razor
Hosts
Security
Advanced
- Configuration options
- Access HTTP specific features in services
- Logging
- Serialization/deserialization
- Request/response filters
- Filter attributes
- Concurrency Model
- Built-in profiling
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Dump Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- MVC Integration
- ServiceStack Integration
- Embedded Native Desktop Apps
- Auto Batched Requests
- Versioning
- Multitenancy
Caching
HTTP Caching 1. CacheResponse Attribute 2. Cache Aware Clients
Auto Query
AutoQuery Data 1. AutoQuery Memory 2. AutoQuery Service 3. AutoQuery DynamoDB
Server Events
Service Gateway
Encrypted Messaging
Plugins
Tests
ServiceStackVS
Other Languages
Amazon Web Services
Deployment
Install 3rd Party Products
Use Cases
Performance
Other Products
Future