Websocket Support (#937)
* Atom / RSS meta link * Spike * Feeling good about this spike now * Remove document.collection * Remove koa.ctx from all presenters to make them portable outside requests * Remove full serialized model from events Move events.add to controllers for now, will eventually be in commands * collections.create event parentDocument -> parentDocumentId * Fix up deprecated tests * Fixed: Doc creation * documents.move * Handle collection deleted * 💚 * Authorize room join requests * Move starred data structure Account for documents with no context on sockets * Add socket.io-redis * Add WEBSOCKETS_ENABLED env variable to disable websockets entirely for self hosted New installations will default to true, existing installations to false * 💚 No need for promise response here * Reload notice
This commit is contained in:
@@ -1,24 +1,74 @@
|
||||
// @flow
|
||||
import Queue from 'bull';
|
||||
import services from './services';
|
||||
import { Collection, Document, Integration } from './models';
|
||||
|
||||
type DocumentEvent = {
|
||||
name: 'documents.create' | 'documents.update' | 'documents.publish',
|
||||
model: Document,
|
||||
type UserEvent = {
|
||||
name: | 'users.create' // eslint-disable-line
|
||||
| 'users.update'
|
||||
| 'users.suspend'
|
||||
| 'users.activate'
|
||||
| 'users.delete',
|
||||
modelId: string,
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
};
|
||||
|
||||
type CollectionEvent = {
|
||||
name: 'collections.create' | 'collections.update',
|
||||
model: Collection,
|
||||
};
|
||||
type DocumentEvent =
|
||||
| {
|
||||
name: | 'documents.create' // eslint-disable-line
|
||||
| 'documents.publish'
|
||||
| 'documents.update'
|
||||
| 'documents.delete'
|
||||
| 'documents.pin'
|
||||
| 'documents.unpin'
|
||||
| 'documents.archive'
|
||||
| 'documents.unarchive'
|
||||
| 'documents.restore'
|
||||
| 'documents.star'
|
||||
| 'documents.unstar',
|
||||
modelId: string,
|
||||
collectionId: string,
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
}
|
||||
| {
|
||||
name: 'documents.move',
|
||||
modelId: string,
|
||||
collectionIds: string[],
|
||||
documentIds: string[],
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
};
|
||||
|
||||
type CollectionEvent =
|
||||
| {
|
||||
name: | 'collections.create' // eslint-disable-line
|
||||
| 'collections.update'
|
||||
| 'collections.delete',
|
||||
modelId: string,
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
}
|
||||
| {
|
||||
name: 'collections.add_user' | 'collections.remove_user',
|
||||
modelId: string,
|
||||
collectionId: string,
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
};
|
||||
|
||||
type IntegrationEvent = {
|
||||
name: 'integrations.create' | 'integrations.update',
|
||||
model: Integration,
|
||||
name: 'integrations.create' | 'integrations.update' | 'collections.delete',
|
||||
modelId: string,
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
};
|
||||
|
||||
export type Event = DocumentEvent | CollectionEvent | IntegrationEvent;
|
||||
export type Event =
|
||||
| UserEvent
|
||||
| DocumentEvent
|
||||
| CollectionEvent
|
||||
| IntegrationEvent;
|
||||
|
||||
const globalEventsQueue = new Queue('global events', process.env.REDIS_URL);
|
||||
const serviceEventsQueue = new Queue('service events', process.env.REDIS_URL);
|
||||
|
||||
Reference in New Issue
Block a user