Sha256: 194ef902d40f94611b97e284e72f6ca7cc51452d9064759de76677cbc6e388b8

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

# Ably fork of MessagePack for Ruby

This fork is needed until [the binary support PR](https://github.com/msgpack/msgpack-ruby/pull/45) is added to the [origin MessagePack gem](https://github.com/msgpack/msgpack-ruby).

```
require 'msgpack'
msg = [1,2,3].to_msgpack  #=> "\x93\x01\x02\x03"
MessagePack.unpack(msg)   #=> [1,2,3]
```

## Install

```
gem install msgpack-ably
```

## Use cases

* Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
* Store objects efficiently in memcached or Redis
* Upload data in efficient format from mobile devices. See also MessagePack for [Objective-C](https://github.com/msgpack/msgpack-objectivec) and [Java](https://github.com/msgpack/msgpack-java)

## Links

* [Github](https://github.com/msgpack/msgpack-ruby)
* [API document](http://ruby.msgpack.org/)
* [MessagePack spec](https://github.com/msgpack/msgpack/blob/master/spec.md)

## Streaming API

```
# serialize a 2-element array [e1, e2]
pk = MessagePack::Packer.new(io)
pk.write_array_header(2).write(e1).write(e2).flush
```

```
# deserialize objects from an IO
u = MessagePack::Unpacker.new(io)
u.each { |obj| ... }
```

```
# event-driven deserialization
def on_read(data)
  @u ||= MessagePack::Unpacker.new
  @u.feed_each(data) { |obj| ... }
end
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
msgpack-ably-0.5.10 msgpack.org.md