What is the best way to limit chatroom messages?

So here is the setup:

Creating a Realtime AngularJS chat application. However, I want to limit the messages that the user sees by an API call that defines other messages within their vicinity.

For some reason I can't wrap this around. I researched socket.io, FireBase, PubNub, and I cannot find a suitable way to restrict the data returned by these services based on an API call that sets the parameters.

Thoughts?

+4
source share
1 answer

Geohashing Chat by Proximity

Try Now: Geohash Chat by Proximity

, lat/long , . .

: GitHub Geo Chat

Geohashing Chat Conversations based on Proximity Zoom Level

Geo Hashing

- / . / , . , Lat/Long.

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Geo Hash
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function geohash( coord, resolution ) {
    var rez = Math.pow( 10, resolution || 0 );
    return Math.floor(coord * rez) / rez;
}

Acquire Lat Long Chat Proximity Location

Geo ""

"Zoom", . Geofencing, , . , Geofencing PubNub. - /- Lat/Long (, X, Y). lat/long, , 1 . PubNub.

// Create Proximity Channel
channel = geohash( pos.latitude, 0 ) + '' + geohash( pos.longitude, 0 );

, . PubNub .

// Connect to Proximity Channel
pubnub.subscribe({
     channel : channel,
     message : receive,
     connect : ready,
    presence : presence
});

Acquired Latitude Longitude Chat Proximity Group

9

, , . "".

Geo Hashing PubNub

! PubNub. navigator.geolocation.getCurrentPosition(...) lat/long Chrome/firefox/ie/opera/mobile/safari.

PubNub Connected Car Solution Kit

Geohashing Chat Conversations based on Proximity Nearby

+4

Source: https://habr.com/ru/post/1534735/


All Articles