-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed ClientEvent in favour of ClientInstruction & ServerInstruction
* Client Connections now have a boolean to say if they are authorized. To be authorized means to be given special access. The socket request must provide a 'users-api-key' header with a valid key matching that in the config socketApiKey * Security Bug Fix: Socket Meta instructions are now secured and only allowed by authorized clients * Removed EventType in favour of ClientInstructionType & ServerInstructionType * Updated tests * Updated references, moved folders/files & updated definition
- Loading branch information
Showing
15 changed files
with
375 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use strict"; | ||
|
||
import * as def from "webinate-users"; | ||
import {ClientConnection} from "./client-connection"; | ||
|
||
/** | ||
* An instruction that is generated by the server and sent to relevant clients. | ||
*/ | ||
export class ClientInstruction<T extends def.SocketEvents.IToken> | ||
{ | ||
/** | ||
* Specify a username that if set, will only send this instruction to authorized clients | ||
* and/or the spefic user who may be connected | ||
*/ | ||
username: string; | ||
|
||
/** | ||
* An array of clients to send the instruction to. If null, then all clients will be considered | ||
*/ | ||
recipients: ClientConnection[]; | ||
|
||
/** | ||
* The event sent from the client | ||
*/ | ||
token: T; | ||
|
||
constructor(event: T, client: ClientConnection[] = null, username : string = null ) | ||
{ | ||
this.recipients = client; | ||
this.token = event; | ||
this.username = username; | ||
} | ||
} |
Oops, something went wrong.