ClientFactory
Class in @sascom/jsclient.
API catalogue · @sascom/jsclient · Class
TypeScript#
class ClientFactoryMembers#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | |
| addConnectionRestoredListener | Method | |
| addNodeChangedListener | Method | |
| addPart | Method | Names a BIM.works package that uses this client, e.g. a viewer; a second call replaces its version. |
| clientHeaders | Method | The headers to add to a request to url: X-BIMworks-Client, and in Node.js the User-Agent. In a browser only on a same-origin request or one that is preflig… |
| close | Method | |
| create | Method | |
| createXmlHttpRequest | Method | |
| forceReconnect | Method | Reconnect the socket now (a request answered NODE_GONE). |
| getClientIdentity | Method | |
| getNetworkUsage | Method | |
| getServerInfo | Method | The node the main socket is on; null before the first hello, or from a server without a fleet. |
| getTask | Method | |
| registerTask | Method | |
| removeNodeChangedListener | Method | |
| removeTask | Method | |
| setClientIdentity | Method | What the client says it is from now on; an open socket hears it at once. |
| setFetchOptionsInterceptor | Method | |
| setXmlHttpRequestInterceptor | Method |
constructor#
TypeScript#
constructor(address: string, settings?: ClientFactorySettings)Parameters#
| Name | Type | Description |
|---|---|---|
address |
string |
|
settings |
ClientFactorySettings |
addConnectionRestoredListener#
TypeScript#
public addConnectionRestoredListener(listener: () => void): voidParameters#
| Name | Type | Description |
|---|---|---|
listener |
() => void |
addNodeChangedListener#
TypeScript#
public addNodeChangedListener(listener: (current: ServerInfo, previous: ServerInfo | null) => void): voidParameters#
| Name | Type | Description |
|---|---|---|
listener |
(current: ServerInfo, previous: ServerInfo | null) => void |
addPart#
TypeScript#
public addPart(name: string, version?: string | null): voidNames a BIM.works package that uses this client, e.g. a viewer; a second call replaces its version.
Parameters#
| Name | Type | Description |
|---|---|---|
name |
string |
|
version |
string | null |
clientHeaders#
TypeScript#
public clientHeaders(url: string, init?: RequestInit): Record<string, string>The headers to add to a request to url: X-BIMworks-Client, and in Node.js the User-Agent. In a browser
only on a same-origin request or one that is preflighted anyway, so no request gets an extra CORS preflight.
Parameters#
| Name | Type | Description |
|---|---|---|
url |
string |
|
init |
RequestInit |
close#
TypeScript#
public close(): voidcreate#
TypeScript#
public create(settings?: ClientFactorySettings): Promise<Client>Parameters#
| Name | Type | Description |
|---|---|---|
settings |
ClientFactorySettings |
createXmlHttpRequest#
TypeScript#
public createXmlHttpRequest(): XMLHttpRequestforceReconnect#
TypeScript#
public forceReconnect(): voidReconnect the socket now (a request answered NODE_GONE).
getClientIdentity#
TypeScript#
public getClientIdentity(): ClientIdentitygetNetworkUsage#
TypeScript#
public getNetworkUsage(): NetworkUsageReportergetServerInfo#
TypeScript#
public getServerInfo(): ServerInfo | nullThe node the main socket is on; null before the first hello, or from a server without a fleet.
getTask#
Parameters#
| Name | Type | Description |
|---|---|---|
client |
Client | |
id |
string |
|
name |
string |
|
nodeId |
string |
registerTask#
Parameters#
| Name | Type | Description |
|---|---|---|
task |
Task |
removeNodeChangedListener#
TypeScript#
public removeNodeChangedListener(listener: (current: ServerInfo, previous: ServerInfo | null) => void): voidParameters#
| Name | Type | Description |
|---|---|---|
listener |
(current: ServerInfo, previous: ServerInfo | null) => void |
removeTask#
Parameters#
| Name | Type | Description |
|---|---|---|
task |
Pick<Task, "id"> |
setClientIdentity#
TypeScript#
public setClientIdentity(identity: ClientIdentity): voidWhat the client says it is from now on; an open socket hears it at once.
Parameters#
| Name | Type | Description |
|---|---|---|
identity |
ClientIdentity |
setFetchOptionsInterceptor#
TypeScript#
public setFetchOptionsInterceptor(fetchOptionsInterceptor: unknown): voidParameters#
| Name | Type | Description |
|---|---|---|
fetchOptionsInterceptor |
unknown |
setXmlHttpRequestInterceptor#
TypeScript#
public setXmlHttpRequestInterceptor(xmlHttpRequestCreationInterceptor: unknown): voidParameters#
| Name | Type | Description |
|---|---|---|
xmlHttpRequestCreationInterceptor |
unknown |