Added presence middleware to sockets
This commit is contained in:
parent
7d75c3c389
commit
7d09c44809
1 changed files with 7 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ const { getGun, getUser, isAuthenticated } = require('../Mediator')
|
||||||
const { deepDecryptIfNeeded } = require('../rpc')
|
const { deepDecryptIfNeeded } = require('../rpc')
|
||||||
const Subscriptions = require('./subscriptions')
|
const Subscriptions = require('./subscriptions')
|
||||||
const GunEvents = require('../contact-api/events')
|
const GunEvents = require('../contact-api/events')
|
||||||
|
const GunActions = require('../../gunDB/contact-api/actions')
|
||||||
const {
|
const {
|
||||||
encryptedEmit,
|
encryptedEmit,
|
||||||
encryptedOn,
|
encryptedOn,
|
||||||
|
|
@ -243,6 +244,12 @@ const startSocket = socket => {
|
||||||
socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
|
socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isAuthenticated()) {
|
||||||
|
socket.onAny(() => {
|
||||||
|
GunActions.setLastSeenApp()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
on('subscribe:query', ({ $shock, publicKey }, response) => {
|
on('subscribe:query', ({ $shock, publicKey }, response) => {
|
||||||
const subscriptionId = uuidv4()
|
const subscriptionId = uuidv4()
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue