Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions src/extensions/scratch3_mesh_v2/gql-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const LIST_GROUPS_BY_DOMAIN = gql`
fullId
name
hostId
createdAt
expiresAt
}
}
Expand All @@ -22,16 +21,22 @@ const CREATE_DOMAIN = gql`
`;

const CREATE_GROUP = gql`
mutation CreateGroup($name: String!, $hostId: ID!, $domain: String!, $maxConnectionTimeSeconds: Int) {
createGroup(name: $name, hostId: $hostId, domain: $domain, maxConnectionTimeSeconds: $maxConnectionTimeSeconds) {
mutation CreateGroup(
$name: String!, $hostId: ID!, $domain: String!, $maxConnectionTimeSeconds: Int, $useWebSocket: Boolean!
) {
createGroup(
name: $name, hostId: $hostId, domain: $domain,
maxConnectionTimeSeconds: $maxConnectionTimeSeconds, useWebSocket: $useWebSocket
) {
id
domain
fullId
name
hostId
createdAt
expiresAt
heartbeatIntervalSeconds
useWebSocket
pollingIntervalSeconds
}
}
`;
Expand All @@ -45,6 +50,8 @@ const JOIN_GROUP = gql`
domain
expiresAt
heartbeatIntervalSeconds
useWebSocket
pollingIntervalSeconds
}
}
`;
Expand Down Expand Up @@ -139,6 +146,33 @@ const FIRE_EVENTS = gql`
}
`;

const RECORD_EVENTS = gql`
mutation RecordEventsByNode($groupId: ID!, $domain: String!, $nodeId: ID!, $events: [EventInput!]!) {
recordEventsByNode(
groupId: $groupId, domain: $domain, nodeId: $nodeId, events: $events
) {
groupId
domain
recordedCount
nextSince
}
}
`;

const GET_EVENTS_SINCE = gql`
query GetEventsSince($groupId: ID!, $domain: String!, $since: String!) {
getEventsSince(groupId: $groupId, domain: $domain, since: $since) {
name
firedByNodeId
groupId
domain
payload
timestamp
cursor
}
}
`;

const ON_MESSAGE_IN_GROUP = gql`
subscription OnMessageInGroup($groupId: ID!, $domain: String!) {
onMessageInGroup(groupId: $groupId, domain: $domain) {
Expand Down Expand Up @@ -203,6 +237,8 @@ module.exports = {
SEND_MEMBER_HEARTBEAT,
REPORT_DATA,
FIRE_EVENTS,
RECORD_EVENTS,
GET_EVENTS_SINCE,
ON_MESSAGE_IN_GROUP,
LIST_GROUP_STATUSES
};
3 changes: 2 additions & 1 deletion src/extensions/scratch3_mesh_v2/mesh-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ const getClient = () => client;
module.exports = {
createClient,
getClient,
gql
gql,
GRAPHQL_ENDPOINT
};
Loading
Loading