3 min read
on Jul 14, 2014
Check out how Xiki and PubNub gives advanced shell users insane flexibility, and watch the PubNub shell integration.

shell linuxXiki is a new text editor which integrates with your shell to give developers unprecedented control over their programs and offers flexibility with displaying lists, commands, input, output. And as of yesterday, PubNub is directly integrated into Xiki. You can learn more about Xiki from the Xiki Kickstarter page, which is currently 75% funded with three days left to go.

In the video below, creator Craig Muth explains the PubNub shell integration:

PubNub works on a publish/subscribe architecture, and using Xiki you can:

  • Publish a message to a channel
  • Subscribe to a channel and see messages pop up as they are received
  • Get the history of messages that have been sent on each channel

By default, Xiki uses the PubNub demo credentials and the channel name “chat”, so you’re able to send messages from your Xiki shell and see them appear on the web in real time through Stephen Blum’s blog post Chat in 10 Lines of Code.

Transcript of the video follows:

This is a demo of the PubNub command I made today, pair programming with Dave Nugent. PubNub backed the kickstarter campaign, so this command will be included with Xiki. Here’s a demo page on their website, it’s an extremely simple chat application. When you send a chat message, it publishes to a PubNub channel, and the chat output subscribes to that channel and shows the messages. So basically PubNub is about sending and receiving messages using the Publish/Subscribe model.

So let’s go to the standard shell window running Bash, and run the new PubNub command that Dave and I made today using Xiki. By default it gives you a bunch of channels to mess around with; the first one is the chat channel that the web app uses. In Xiki you can move the cursor around using the arrow keys, and then expand items by typing Ctrl-E, which you can see on the bottom. If we do Ctrl-E on one of the messages it will send it, and you can see it show up in the web browser. And, you can edit a message to customize it. You can see at the bottom of the terminal that Ctrl-Q will quit, so let’s do that.

So we just used our PubNub command to publish a message, now let’s use it to subscribe in this other window here. Let’s expand chat, and then the subscribe menu item. If we chat something using the web browser we’ll see it show up, and of course if we use our command to publish it, we’ll see it show up as well.

Let’s Ctrl-Q back to the shell, and then type pubnub chat to jump right to the chat channel. Then let’s go to history and see the recent messages. I’ll type “hi” to filter down, which you can always do in Xiki when you expand. Now let’s type “pubnub” and go down to the setup menu. You can jump to their web interface to grab your credentials, and then paste them into the Xiki conf.

So pretty good for two people and an hour and a half of planning and coding. Here’s the code for the menu; it’s just two screens. You can see it’s just the minimum possible code to make things work. Xiki commands get text as input and send text to output, so they’re really easy to code. This one is Ruby, but you can also do them in JavaScript, Python and other languages.

If you want to be able to use and create commands like this, back the Xiki kickstarter. There are four days left, and we’re 70% there. It’s gonna be close! Companies, check out the $10,000 reward category. It’s a great opportunity to get a ton of appreciation and notice from cutting edge developers.

Thanks for watching and thanks for the support — It’s been amazing. Also check out my interview in the latest interview of the Change Log podcast.

More From PubNub