pubnub 0.1.0 copy "pubnub: ^0.1.0" to clipboard
pubnub: ^0.1.0 copied to clipboard

outdatedDart 1 only

A simple PubNub wrapper in Dart.

example/main.dart

// Copyright (c) 2016, Sebastian Nozzi. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:pubnub/pubnub.dart';

import 'user_interface.dart';
import 'js_interop.dart';

void main() {
  final ui = new UserInterface();

  final pubnubDemo = new PubNub(
      publishKey: 'pub-a4ec9cdc-0120-4f9e-8f36-d1aba394abce',
      subscribeKey: 'sub-ef818b5e-70db-11e1-97bc-3fa70795ed6c');

  ui.onTextInput((txt) {
    ui.resetInputField();
    pubnubDemo.publish(channel: 'demo_tutorial',
        message: new ChatMsg(text: txt));
  });

  pubnubDemo.subscribe('demo_tutorial');
  pubnubDemo.addListener((PubNubEvent event){
    String chatText = event.message.text;
    ui.appendListItemWithText(chatText);
  });

}
50
likes
0
pub points
92%
popularity

Publisher

verified publisherpubnub.com

A simple PubNub wrapper in Dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

browser, js

More

Packages that depend on pubnub