Skip to content

Params with streamInOut #1724

Closed Answered by copy-paste-repeat
copy-paste-repeat asked this question in Help
Discussion options

You must be logged in to vote

Example which is working for me

import { api, StreamInOut } from "encore.dev/api";
import log from "encore.dev/log";

// Type definitions for messages
interface ProjectSyncHandshakeParams {
    projectId: string;  // Project identifier from the URL
    clientId: string;   // Unique client identifier
}

interface IncomingMessage {
    data: any;
}

interface OutgoingMessage {
  data: any;
}

export const projectSync = api.streamInOut<ProjectSyncHandshakeParams, IncomingMessage, OutgoingMessage>({ path: '/projects/:projectId', expose: true }, async (params, stream) => {
  log.debug(params.projectId);
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@luisnquin
Comment options

Answer selected by copy-paste-repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants