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

geospatial-messaging-client

v1.0.6

Published

![geospatial-messaging-client promo-art](https://raw.githubusercontent.com/sudowing/geospatial-messaging-client/develop/assets/geohash-layers.png "Geospatial Messaging Client | Promo Poster (Geohash Scales and Custom Polygons)")

Downloads

216

Readme

Geospatial Messaging Client

geospatial-messaging-client promo-art

The purpose of this client is to facilitate communication via geospatial area -- meaning the client will have the ability to define custom polygons for broadcasting via Pub/Sub.

The core mechanism enabling this solution involves normalizing all custom polygons to a base grid -- made up of geohashes. Each geohash maps to a redis channel, where messages get published, enabling other clients to subscribe via redis.psubscribe.

A client subscribes to all tiles/channels that intersect with the defined custom polygon -- and publishes any message to this same set of tiles/channels.

As currently implemented, a client can subscribe to geohash tiles at/beneath them, while publishing at/above them.

Client Overview: Basic Usage

import GeoSpatialClient from 'geospatial-messaging-client';
import * as samples from './data_samples.js';

const eventHandler = ({eventType, ...event}) => console.log(eventType || 'default', `${JSON.stringify(event)}`);

const client = new GeoSpatialClient({polygon_coordinates: samples.coords_002, geohash_length: 5});

// subscribe to the event stream (RxJS)
client.observable.subscribe(eventHandler);

await client.connect({});

await client.send({hello: 'world'});
await client.send({goodbye: 'night'});

const film = {
   name: 'harry potter'
  ,year: 2001
  ,run_time: '152 minutes'
  ,bidget: '$125M'
  ,box_office: '$1.024B'      
}
await client.send(film, 'movieShowing');

CHANGE 01 // location

await client.update({polygon_coordinates: samples.circle_coordinates, geohash_length: 5});

await client.send({strawberry: 'fields'});
await client.send({sargent: 'peppers'});

const bar = {
    venue: 'The Bull and Finch Pub'
   ,date: '2024-01-04'
   ,address: {
      street: '84 Beacon St'
     ,city: 'Boston'
     ,state: 'MA'
     ,zipcode: '02108'
   }
}

await client.send(bar, 'happyHour');

CHANGE 02 // location, geohash_length & party_key

await client.update({polygon_coordinates: samples.star_coordinates, geohash_length: 5, party_key: 'grp42'});

await client.send({atlanta: 'braves'});
await client.send({philadlephia: 'eagles'});

const concert = {
    artist: 'The Foo Fighters'
   ,date: '2024-6-23'
   ,address: {
     street: 'Hershey Park Stadium'
     ,city: 'Hershey'
     ,state: 'PA'
     ,zipcode: '02108'
   }
}

await client.send(concert, 'liveMusic');

disconnect

await client.disconnect();

Development Notes

run redis locally


# create docker network (if db on docker network)
docker network create mynetwork

docker run -d \
	--network mynetwork \
	-p 6379:6379 \
	--name some-redis \
	redis

package publishing

npm login

npm run release

Future Features

  • mcache handling (short TTLs)
  • direct messaging (client_id <-> client_id)
  • party messaging