Skip to Main Content
Getting Started with GEO, CouchDB, and Node.js
book

Getting Started with GEO, CouchDB, and Node.js

by Mick Thompson
July 2011
Beginner content levelBeginner
66 pages
1h 19m
English
O'Reilly Media, Inc.
Content preview from Getting Started with GEO, CouchDB, and Node.js

Chapter 4. MapChat - Example Project

Node.js has made it simple to run event code on the web, as well as perform some basic geospatial operations. CouchDB gives a quick easy way to query spatial indices as well as a robust document based data store. Combined, these tools can be used to easily create a great new project.

The project is www.mapchat.im. It will allow users to interact by posting real-time chat messages that are tagged with their current location on the map. Other users will see only the messages that are in their current map bounds. CouchDB will be used to store history for the map chat room, and will also handle server side point clustering so multiple chat messages in the same area will be grouped into a conversations. The project will include several other smaller features, including using a custom Google Maps overlay to display chat messages.

Realtime Chat

There are many chat examples for Node.js. Some of the more interesting Node.js projects leverage websockets where available and use JSON to exchange data quickly, giving the developer a synchronized object that both the client- and server-side JavaScript can use. XHR-long polling is also a technique used in order to provide information about changes from the server or client quickly, even in older browsers. One project has become in many ways the standard for real-time communication between the browser and the server: socket.io.

Socket.io

Socket.io provides a simple API for an application to use to handle messages ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

HTML5 Geolocation

HTML5 Geolocation

Anthony T. Holdener
Scaling CouchDB

Scaling CouchDB

Bradley Holt
9 Practical Node.js Projects

9 Practical Node.js Projects

James Hibbard, James Kolce, Lukas White, Jeremy Wilken, Simon Holmes, Michael Wanyoike, Paul Orac, Patrick Catanzariti

Publisher Resources

ISBN: 9781449311230Errata Page