Implements Windows Phone 7.1 and 8.0 push notifications as described on MSDN.
EM.run do
toast = EM::WPN::Windows71::Toast.new("http://live.net...",
:text1 => "Hello",
:text2 => "World"
)
response = EM::WPN.push(toast)
end
EM.run do
tile = EM::WPN::Windows71::Tile.new("http://live.net...",
:background_image => "/image.png",
:count => 5,
:title => "Hello World"
)
response = EM::WPN.push(tile)
end
Windows Phone 8 tiles are available in additional classes:
EM::WPN::Windows8::IconicTile
EM::WPN::Windows8::FlipTile
Responses are implemented as EM deferrables. Callbacks are invoked whenever a tile or toast is successfully delivered:
response = EM::WPN.push(toast)
response.callback do |response|
response.status # => 200
response.duration # => ms
response.http # => EM::HttpClient
end
Errbacks are invoked for any non-200 response as well as network errors:
response = EM::WPN.push(tile)
response.errback do |response|
response.status # => e.g. 404 (nil for connection errors)
response.error # => Notification status or connection error
end
- Raw notifications
- SSL request signing (see this)
This is a direct clone of Dave Yeu's em-apn gem.