Secure Chat Example App IoT Example App Realtime Charts Example App

Realtime Apps Made Simple

APIs for developers building secure realtime Mobile, Web, and IoT Applications

Programmable Network Icon

The Programmable Network

The PubNub Data Stream Network powers low-latency secure messaging on every device, at massive scale.

PubNub BLOCKS makes the network programmable, executing your application logic on data as it passes over the network, removing the need to deploy and scale app servers.

Simple APIs - Powerful Network

The world’s first programmable network allows you to focus on shipping a great product instead of building and managing expensive infrastructure.

Publish
JavaScript
.NET
iOS (Obj-C)
iOS (Swift)
Android / Java
// send a message
pubnub.publish({
    channel: 'chatChannel',
    message: { foo : 'bar' }
}, function ( status, response ) {
    console.log( status.error, response )
})

 

Dictionary<string, string> sendMessage = new Dictionary<string, string>();
sendMessage.Add("foo", "bar");

pubnub.Publish<string>(
    channel:"chatChannel", 
    message: sendMessage, 
    userCallback: DisplayPublishReturnMessage, 
    errorCallback: DisplayErrorMessage);

 

- (void)client:(PubNub *)client didReceiveStatus:(PNStatus *)status {
  
    if (status.operation == PNSubscribeOperation && status.category == PNConnectedCategory) {
    
        [self.client publish: @{@"foo": @"bar"} toChannel: @"chatChannel"
              withCompletion:^(PNPublishStatus *publishStatus) {
  
            if (!publishStatus.isError) {
            NSLog(@"Published!");
            }
            else {
                NSLog(@"Publish did fail with error: %@", 
                      status.errorData.data?: status.errorData.information);
            }
        }];
    }
}

 

func client(client: PubNub, didReceiveStatus status: PNStatus) {
 
    if status.operation == .SubscribeOperation && status.category == .PNConnectedCategory {

        client.publish(["foo": "bar"], toChannel: "chatChannel", 
                       withCompletion: { (publishStatus) in
 
            if !publishStatus.error {
                print("Published!")
            }
            else {
                print("Publish did fail with error: \(status.errorData.data ?? status.errorData.information)")
            }
        })
    }
}

 

Map message = new HashMap();
message.put("foo", "bar");

pubnub.publish()
        .channel("chatChannel")
        .message(message)
        .async(new PNCallback<PNPublishResult>() {
            @Override
            public void onResponse(PNPublishResult result, PNStatus status) {
                if (status.isError()) {
                    System.out.println(status);
                } else {
                    System.out.println("Published!");
                }
            }
        });

 

BLOCKS Execution
BLOCKS Executions
export default request => {
    request.message.hello = 'world!'
    return request.ok()
}

 

70+ Realtime SDKs

Choose from over 70 Realtime SDKs to easily connect your mobile, web, and IoT devices to the PubNub Data Stream Network.

Objective-CSwiftAndroidJavaJavascriptNodeJSArduinoAngularJS.NET (3.5+)GoPythonUnityRubyRaspberry PiPosix CPosix C++
Powerful Features

Our easy to use APIs make developing realtime applications easy.

Publish Subscribe Messaging
Publish Subscribe Messaging

Send and receive messages in under 0.25 seconds worldwide.

Online Presence Detection
Online Presence Detection

Monitor users and devices in realtime to know who is online and offline.

Data Stream Storage
Data Stream Storage

Store and retrieve messages for chat history, auditing, and more.

Mobile Push Notifications
Mobile Push Notifications

Increase engagement with push notifications for iOS and Android.

Access Manager
Access Manager

Keep firm control over who has access to what data.

Scale Matters
Messages
1.8
Trillion
Messages per Month
Devices
330+
Million
Unique Devices per Month
Global
15
Global
Point of Presence

Try PubNub Today

Connect up to 100 devices for Free
Get Started with PubNub Realtime Data Stream Network
Loading...