TypeScript client for Tile38 geo-database
MIT License
Bot releases are visible (Hide)
// Start a channel that sends event, when object in 'fleet'
// enters the area of a 500m radius around
// latitude 33.5123 and longitude -112.2693 with the Leader
await tile38
.setChan('warehouse')
.nearby('fleet')
.point(33.5123, -112.2693, 500)
.exec();
Now add a receiving channel and add an event handler.
// also as of tile38 v1.33.1 followers can open a channel
const followerChannel = await tile38.follower().channel();
followerChannel.on('message', (message) => console.log(message));
Now that channel can:
// also as of tile38 v1.33.1 followers can open a channel
await followerChannel.subscribe('warehouse');
// or pattern subscribed to
await followerChannel.pSubscribe('ware*');
Every .set()
on the leader results in the geofence event
being forwarded to the follower channel.
await tile38.set('fleet', 'bus').point(33.5123001, -112.2693001).exec();
// event =
> {
"command": "set",
"group": "5c5203ccf5ec4e4f349fd038",
"detect": "inside",
"hook": "warehouse",
"key": "fleet",
"time": "2021-03-22T13:06:36.769273-07:00",
"id": "bus",
"meta": {},
"object": { "type": "Point", "coordinates": [-112.2693001, 33.5123001] }
}
// to unsubscribed
await followerChannel.unsubscribe();
// to delete with the leader
await tile38.delChan('warehouse');
// or pattern delete with the leader
await tile38.pDelChan('ware*');
Published by github-actions[bot] 4 months ago
Added the WHEREIN
subcommand to allow to filter values in a search by whether they're contained in an
input array of values.
await tile38
.set('fleet', 'truck1')
.fields({ weight: 9001 })
.point(33.5123, -112.2693)
.exec();
await tile38
.set('fleet', 'truck2')
.fields({ weight: 9003 })
.point(33.5123, -112.2693)
.exec();
let response = await tile38.scan('fleet').wherein('weight',[9003]).asCount().exec();
console.log(response)
> {"ok":true,"count":1,"cursor":0,"elapsed":"2.078168ms"}
response = await tile38.scan('fleet').wherein('weight',[9001,9003]).asCount().exec();
console.log(response)
> {"ok":true,"count":2,"cursor":0,"elapsed":"2.078168ms"}
Published by github-actions[bot] 4 months ago
await tile38
.set('fleet', 'truck1')
.fields({ maxSpeed: 90, milage: 90000 })
.point(33.5123, -112.2693)
.exec();
let response = await tile38.fexists('fleet', 'truck1', 'weight');
console.log(response.exists);
// > true
response = await tile38.fexists('fleet', 'truck1', 'milage');
console.log(response.exists);
// > false
response = await tile38.exists('fleet', 'truck1');
console.log(response.exists);
// > true
response = await tile38.exists('fleet', 'truck2');
console.log(response.exists);
// > false
Published by github-actions[bot] 6 months ago
Published by github-actions[bot] 7 months ago
Published by github-actions[bot] 8 months ago
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] about 1 year ago
We now expose ioredis options on the constructor
new Tile38(
'leader:9851',
'follower:9851',
// e.g. to set a retry strategy
{
retryStrategy: (times) => {
return Math.min(times * 50, 2000);
},
}
);
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] over 1 year ago