npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

websocket-spellcheck-service

v0.90.20

Published

A real-time spell checker service based on faye pub/sub websockets

Downloads

23

Readme

Websocket Spell Check Service


A real-time spell checking service over web sockets.

NPM version Build Status Dependency Status

Introduction

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.

Installation

Server

	npm install websocket-spellcheck-service --save

Client/Browser

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>
<html>
<head>
    <title>spell check page</title>
    <script src="browser-messaging-commons.js"></script>
    <script src="messaging-config.js"></script>
    <script src="SpellCheckClient.js"></script>
    <script>
        var client;

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

            client = SpellCheckClient.createInstance( options );

            client.start();

            window.client = client;
        };

    </script>
</head>

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:

{
	"word":"expectorant",
    "correct":true
}

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

{
	"word":"spitx",
    "correct":false,
    "suggestions":["spits","spit","spite","spitz"]
}

Or this:

{
	"word":"expector",
    "correct":false,
    "suggestions":[
    	"expiator",
        "expeditor",
        "expect",
        "expected",
        "expects",
        "expect or",
        "expect-or"
    ]
}

Server

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 );

    service.start();

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.

Configuration

Here is a sample configuration file.

{
    "port":29169,
    "hubName":"/MessageHub",
    "channels":[ "/spellcheck" ],
    "appkey":"71268c55-a8b3-4839-a1f5-34e3d6e70fdd"
}

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

Tests

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

    make test

    or

    make watch

    or

    grunt mochaTest jshint validate-package