Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
class Server
import { Server } from "https://deno.land/x/denosoar@v0.03/communication/server.ts";

A server that can be spun up inside any process and will mine and transmit memory data via a Websocket connection. The server contains simple endpoints that allow the user to interact with the way data is being mined/transmitted.

Constructors

new
Server(port: number)

Properties

private
app: Application
private
controller: AbortController
private
deleteWS: () => unknown
private
encoder: TextEncoder
private
frequency: number
private
interval: number
private
platform: string
private
port: number
private
router: Router
private
setWS: (ws: WebSocket) => unknown

setWS and deleteWS allow for mutable Websocket connections. The user can freely disconnect and reconnect via the GUI.

private
ws: WebSocket | null
close: () => unknown
createData: () => unknown

Generate data in an OS dependent form, record/send the data if requested. Deno's memoryUsage() function generates an incorrect value for rss, so this is calculated via the terminal.

date: Date
record: (mem: RealMemory) => unknown

Writes the memory data to a csv file for as long as requested. CSV files can be processed on the GUI.

recording: boolean
spin: () => unknown

Spins up the server and allows the user to interact with the server via simple endpoints.

startRecord: () => unknown

stopRecord and startRecord allow the user to sample data at different times. New files will be created with the current date each time startRecord is called. Files are created in the repo where the server is initialized.

stopRecord: () => unknown