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.
// 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!");
}
}
});export default request => {
request.message.hello = 'world!'
return request.ok()
}// receive a message
pubnub.subscribe({ channels: ['chatChannel'] })
pubnub.addListener({
message: function (message) {
console.log(message)
}
})pubnub.Subscribe<string>(
channel: "chatChannel",
subscribeCallback: (result) => { Console.WriteLine(result); },
connectCallback: DisplaySubscribeConnectStatusMessage,
errorCallback: DisplayErrorMessage);[self.client addListener:self];
[self.client subscribeToChannels: @[@"chatChannel"] withPresence:NO];
- (void)client:(PubNub *)client didReceiveMessage:(PNMessageResult *)message {
NSLog(@"%@", message.data.message);
}client.addListener(self)
client.subscribeToChannels(["chatChannel"], withPresence: false)
func client(client: PubNub, didReceiveMessage message: PNMessageResult) {
print("\(message.data.message)")
}pubnub.addListener(new SubscribeCallback() {
@Override
public void message(PubNub pubnub, PNMessageResult message) {
System.out.println(message);
}
});
Language Translator Watson Language Translator service provides domain-specific translation among eleven languages
Hello World Simple "Hello World" always delivers { "hello" : "world" }
SendGrid Email Use the SendGrid API to send the contents of a ...
Text to Speech Convert message text to audible speech with IBM Watson
Plot Outliers on Graph Detects outliers and highlights them on a realtime graph.
Gif Chat Add fun gifs to chat messages using the Giphy API.
Vote Counter Vote counter block lets people cast their vote in an ...
AlchemyLanguage Analyze text to understand its sentiment, keywords, entities, high-level concepts ...
Offline Notifier Block Notify offline users via SMS of any newly published messages.
Falkonry Time Series AI Run artificial intelligence on streaming time series data with the ...