A real-time spell service over web sockets



Websocket Spell Check Service

A real-time spell checking service over web sockets.

NPM version Build Status Dependency Status


The Websocket Spellcheck Service provides a remote real-time service to check word spelling from browser or other text input applications. The spell checker is based on node-spellchecker and uses the hunspell project.



    npm install websocket-spellcheck-service --save


The project includes a "browser" folder with enough to create a websocket spell checker. Here is a short snippet of the browser code:

<!DOCTYPE html>
    <title>spell check page</title>
    <script src="browser-messaging-commons.js"></script>
    <script src="messaging-config.js"></script>
    <script src="SpellCheckClient.js"></script>
        var client;

        var start = function() {
            var options = readMessagingConfig();
            console.log( JSON.stringify( options ));

            client = SpellCheckClient.createInstance( options );


            window.client = client;


The clint API has a single method: checkSpelling(word). The word is sent down the socket with a request to check the spelling with the response being delivered to a closure called checkResultCallback that is set in the constuctor options. If the spelling is correct, the reponse from the service looks like this:


If an error is detected in the spelling, the response includes spelling suggestions and looks like this:


Or this:

        "expect or",


The project includes a "bin" folder with a run/start/stop and status scripts. The run script is the same as start, but it runs in the forgound. It looks something like this:

    var config = require('./config.json'),
        SpellCheckService = require('websocket-spellcheck-service'),
        service = SpellCheckService.createInstance( config );


If you have a message service running on this port, then this is enough to start the public producer channel that responds to spell check requests. To create and start a generic message service, see this commons project.


Here is a sample configuration file.

    "channels":[ "/spellcheck" ],

You would want to have a proxy and preferrably HTTPS in front of this but port 29169 works for development.


Unit tests include should/specs, jshint and validate-package. Tests can be run from the command line with this:

    make test


    make watch


    grunt mochaTest jshint validate-package

Copyright © 2014-2015, rain city software | Version 0.90.20