Skip to content

Commit

Permalink
@foxglove/ws-protocol-examples: Bump ws-protocol dependency, cleanup …
Browse files Browse the repository at this point in the history
…service server (#795)

### Changelog
None

### Docs
None

### Description

- Bumps the `@foxglove/ws-protocol` dependency
- Reverts accidentally committed change (from #783)
  • Loading branch information
achim-k authored Jul 29, 2024
1 parent e478831 commit 663a7e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion typescript/ws-protocol-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@foxglove/schemas": "^1.6.2",
"@foxglove/wasm-lz4": "^1.0.2",
"@foxglove/wasm-zstd": "^1.0.1",
"@foxglove/ws-protocol": "0.7.3",
"@foxglove/ws-protocol": "0.7.4",
"@mcap/core": "^2.1.2",
"boxen": "^7.1.1",
"commander": "^11.1.0",
Expand Down
20 changes: 1 addition & 19 deletions typescript/ws-protocol-examples/src/examples/service-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ServerCapability,
Service,
ServiceCallPayload,
StatusLevel,
} from "@foxglove/ws-protocol";
import { Command } from "commander";
import Debug from "debug";
Expand All @@ -30,8 +29,6 @@ async function main(): Promise<void> {
});
setupSigintHandler(log, ws);

let callCount = 0;

const serviceDefRos: Omit<Service, "id"> = {
name: "/set_bool_ros",
type: "std_srvs/SetBool",
Expand Down Expand Up @@ -128,11 +125,7 @@ async function main(): Promise<void> {
throw err;
}

log(
"Received service call request with %d bytes, call count %d",
request.data.byteLength,
callCount,
);
log("Received service call request with %d bytes", request.data.byteLength);

const responseMsg = {
success: true,
Expand All @@ -154,17 +147,6 @@ async function main(): Promise<void> {
data: new DataView(responseData.buffer),
};
server.sendServiceCallResponse(response, clientConnection);

if (callCount % 2 === 0) {
server.sendStatus({
level: StatusLevel.INFO,
message: "Service was called :)",
id: "statusFoo",
});
} else {
server.removeStatus(["statusFoo"]);
}
callCount++;
});
server.on("error", (err) => {
log("server error: %o", err);
Expand Down

0 comments on commit 663a7e4

Please sign in to comment.