Reference·JavaScript · @sascom/jsclientJavaScript

ClientFactory

Class in @sascom/jsclient.

API catalogue · @sascom/jsclient · Class

TypeScript#
class ClientFactory

Members#

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): void

Parameters#

Name Type Description
listener () => void

addNodeChangedListener#

TypeScript#
public addNodeChangedListener(listener: (current: ServerInfo, previous: ServerInfo | null) => void): void

Parameters#

Name Type Description
listener (current: ServerInfo, previous: ServerInfo | null) => void

addPart#

TypeScript#
public addPart(name: string, version?: string | null): void

Names 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(): void

create#

TypeScript#
public create(settings?: ClientFactorySettings): Promise<Client>

Parameters#

Name Type Description
settings ClientFactorySettings

createXmlHttpRequest#

TypeScript#
public createXmlHttpRequest(): XMLHttpRequest

forceReconnect#

TypeScript#
public forceReconnect(): void

Reconnect the socket now (a request answered NODE_GONE).

getClientIdentity#

TypeScript#
public getClientIdentity(): ClientIdentity

getNetworkUsage#

TypeScript#
public getNetworkUsage(): NetworkUsageReporter

getServerInfo#

TypeScript#
public getServerInfo(): ServerInfo | null

The node the main socket is on; null before the first hello, or from a server without a fleet.

getTask#

TypeScript#
public getTask(client: Client, id: string, name: string, nodeId?: string): Task

Parameters#

Name Type Description
client Client
id string
name string
nodeId string

registerTask#

TypeScript#
public registerTask(task: Task): void

Parameters#

Name Type Description
task Task

removeNodeChangedListener#

TypeScript#
public removeNodeChangedListener(listener: (current: ServerInfo, previous: ServerInfo | null) => void): void

Parameters#

Name Type Description
listener (current: ServerInfo, previous: ServerInfo | null) => void

removeTask#

TypeScript#
public removeTask(task: Pick<Task, "id">): void

Parameters#

Name Type Description
task Pick<Task, "id">

setClientIdentity#

TypeScript#
public setClientIdentity(identity: ClientIdentity): void

What 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): void

Parameters#

Name Type Description
fetchOptionsInterceptor unknown

setXmlHttpRequestInterceptor#

TypeScript#
public setXmlHttpRequestInterceptor(xmlHttpRequestCreationInterceptor: unknown): void

Parameters#

Name Type Description
xmlHttpRequestCreationInterceptor unknown