Interapplication communication in JavaScript

How are we going to do interapplication communication between apps written in JavaScript running on the same machine?

I use localStorage

The client app stores a string in known location. The server watches that location. When a string shows up, convert it to uppercase, delete the string, and store the new string in another known location.

The client app is watching that location, when a value shows up, it displays it for the user.

A limit

There is a limit — the two apps have to originate from the same domain, because only apps from the same domain can share space in localStorage.

Example app

The example app is in a GitHub repository.

https://github.com/scripting/interAppComm

Download the client and server and drag them into your browser.

Enter a string in the client. Click the Submit button. See the result.

Seeing is believing

Some people don’t believe this works. It does.

I’ve deployed it in a real-world app, and there have been no support issues.

And with this demo, you can see with your own eyes.

Advertisements

About Dave Winer

Dave Winer, 54, pioneered the development of weblogs, syndication (RSS), podcasting, outlining, and web content management software; former contributing editor at Wired Magazine, research fellow at Harvard Law School, entrepreneur, and investor in web media companies. A native New Yorker, he received a Master's in Computer Science from the University of Wisconsin, a Bachelor's in Mathematics from Tulane University and currently lives in Berkeley, California.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s