From 0662a13da7b527c7ed70fa9c02b6a7d02142f6c1 Mon Sep 17 00:00:00 2001 From: Hugo Arregui Date: Thu, 14 Apr 2022 16:25:27 -0300 Subject: [PATCH] new protocol --- src/controllers/handlers/ws-room-handler.ts | 124 +- src/controllers/handlers/ws-rooms-handler.ts | 139 -- src/controllers/proto/bff.proto | 33 + src/controllers/proto/bff_pb.d.ts | 124 ++ src/controllers/proto/bff_pb.js | 889 ++++++++ src/controllers/proto/comms.d.ts | 227 -- src/controllers/proto/comms.js | 1049 --------- src/controllers/proto/comms.proto | 32 +- src/controllers/proto/comms_pb.d.ts | 293 +++ src/controllers/proto/comms_pb.js | 2068 ++++++++++++++++++ src/controllers/proto/compile-protobuf.sh | 7 + src/controllers/proto/ws.proto | 32 + src/controllers/proto/ws_pb.d.ts | 124 ++ src/controllers/proto/ws_pb.js | 889 ++++++++ src/controllers/routes.ts | 2 - 15 files changed, 4561 insertions(+), 1471 deletions(-) delete mode 100644 src/controllers/handlers/ws-rooms-handler.ts create mode 100644 src/controllers/proto/bff.proto create mode 100644 src/controllers/proto/bff_pb.d.ts create mode 100644 src/controllers/proto/bff_pb.js delete mode 100644 src/controllers/proto/comms.d.ts delete mode 100644 src/controllers/proto/comms.js create mode 100644 src/controllers/proto/comms_pb.d.ts create mode 100644 src/controllers/proto/comms_pb.js create mode 100755 src/controllers/proto/compile-protobuf.sh create mode 100644 src/controllers/proto/ws.proto create mode 100644 src/controllers/proto/ws_pb.d.ts create mode 100644 src/controllers/proto/ws_pb.js diff --git a/src/controllers/handlers/ws-room-handler.ts b/src/controllers/handlers/ws-room-handler.ts index 8e5116e..83dd543 100644 --- a/src/controllers/handlers/ws-room-handler.ts +++ b/src/controllers/handlers/ws-room-handler.ts @@ -2,9 +2,16 @@ import { upgradeWebSocketResponse } from "@well-known-components/http-server/dis import { IHttpServerComponent } from "@well-known-components/interfaces" import { WebSocket } from "ws" import { GlobalContext } from "../../types" -import * as proto from "../proto/broker" +import { + MessageType, + MessageHeader, + MessageTypeMap, + SystemMessage, + IdentityMessage +} from "../proto/ws_pb" const connectionsPerRoom = new Map>() + function getConnectionsList(roomId: string): Set { let set = connectionsPerRoom.get(roomId) if (!set) { @@ -41,65 +48,76 @@ export async function websocketRoomHandler( ws.on("message", (message) => { const data = message as Buffer - const msgType = proto.CoordinatorMessage.deserializeBinary(data).getType() - - if (msgType === proto.MessageType.PING) { - ws.send(data) - } else if (msgType === proto.MessageType.TOPIC) { - const topicMessage = proto.TopicMessage.deserializeBinary(data) - const topicFwMessage = new proto.TopicFWMessage() - topicFwMessage.setType(proto.MessageType.TOPIC_FW) - topicFwMessage.setFromAlias(alias) - topicFwMessage.setBody(topicMessage.getBody_asU8()) - - const topicData = topicFwMessage.serializeBinary() + let msgType = MessageType.UNKNOWN_MESSAGE_TYPE as MessageTypeMap[keyof MessageTypeMap] + try { + msgType = MessageHeader.deserializeBinary(data).getType() + } catch (err) { + logger.error('cannot deserialize message header') + return + } - // Reliable/unreliable data - connections.forEach(($) => { - if (ws !== $) { - $.send(topicData) + switch (msgType) { + case MessageType.UNKNOWN_MESSAGE_TYPE: { + logger.log('unsupported message') + break + } + case MessageType.SYSTEM: { + try { + const message = SystemMessage.deserializeBinary(data) + message.setFromAlias(alias) + + // Reliable/unreliable data + connections.forEach(($) => { + if (ws !== $) { + $.send(message.serializeBinary()) + } + }) + } catch (e) { + logger.error(`cannot process system message ${e}`) } - }) - } else if (msgType === proto.MessageType.TOPIC_IDENTITY) { - const topicMessage = proto.TopicIdentityMessage.deserializeBinary(data) - - const topicFwMessage = new proto.TopicIdentityFWMessage() - topicFwMessage.setType(proto.MessageType.TOPIC_IDENTITY_FW) - topicFwMessage.setFromAlias(alias) - topicFwMessage.setIdentity(aliasToUserId.get(alias)!) - topicFwMessage.setRole(proto.Role.CLIENT) - topicFwMessage.setBody(topicMessage.getBody_asU8()) - - const topicData = topicFwMessage.serializeBinary() - - // Reliable/unreliable data - connections.forEach(($) => { - if (ws !== $) { - $.send(topicData) + break + } + case MessageType.IDENTITY: { + try { + const message = IdentityMessage.deserializeBinary(data) + message.setFromAlias(alias) + message.setIdentity(userId) + + // Reliable/unreliable data + connections.forEach(($) => { + if (ws !== $) { + $.send(message.serializeBinary()) + } + }) + } catch (e) { + logger.error(`cannot process identity message ${e}`) } - }) + break + } + default: { + logger.log(`ignoring msgType ${msgType}`) + break + } } - }) - - setTimeout(() => { - const welcome = new proto.WelcomeMessage() - welcome.setType(proto.MessageType.WELCOME) - welcome.setAlias(alias) - const data = welcome.serializeBinary() - ws.send(data) - }, 100) - - ws.on("error", (error) => { - logger.error(error) - ws.close() - connections.delete(ws) - }) - ws.on("close", () => { - logger.info("Websocket closed") - connections.delete(ws) + ws.on("error", (error) => { + logger.error(error) + ws.close() + const room = connectionsPerRoom.get(roomId) + if (room) { + room.delete(ws) + } + }) + + ws.on("close", () => { + logger.info("Websocket closed") + const room = connectionsPerRoom.get(roomId) + if (room) { + room.delete(ws) + } + }) }) }) } diff --git a/src/controllers/handlers/ws-rooms-handler.ts b/src/controllers/handlers/ws-rooms-handler.ts deleted file mode 100644 index 161d7a9..0000000 --- a/src/controllers/handlers/ws-rooms-handler.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { upgradeWebSocketResponse } from "@well-known-components/http-server/dist/ws" -import { IHttpServerComponent } from "@well-known-components/interfaces" -import { WebSocket } from "ws" -import { GlobalContext } from "../../types" -import * as proto from "../proto/broker" -import { Category, DataHeader, PositionData, ProfileData } from "../proto/comms" -import { Subscription } from "nats" - -const HEARTBEAT_REFRESH_RATE = 100 // ms -const connections = new Set() -const subscriptionsPerConnection = new WeakMap>() - -const connectionHeartbeats = new WeakMap() - -let connectionCounter = 0 - -const aliasToUserId = new Map() -type Position3D = [number, number, number] - -function getSubscriptionsList(socket: WebSocket): Set { - let set = subscriptionsPerConnection.get(socket) - if (!set) { - set = new Set() - subscriptionsPerConnection.set(socket, set) - } - return set -} - -export async function websocketRoomsHandler(context: IHttpServerComponent.DefaultContext) { - const messageBroker = context.components.messageBroker - const logger = context.components.logs.getLogger("Websocket Handler") - logger.info("Websocket") - - return upgradeWebSocketResponse((socket) => { - logger.info("Websocket connected") - // TODO fix ws types - const ws = socket as any as WebSocket - - connections.add(ws) - - const alias = ++connectionCounter - - const query = context.url.searchParams - const userId = query.get("identity") as string - aliasToUserId.set(alias, userId) - - connections.add(ws) - - const subscription = messageBroker.subscribe("island", (topicData: any) => { - ws.send(topicData) - }) - const subscriptionList = getSubscriptionsList(ws) - subscriptionList.add(subscription) - - ws.on("message", (message) => { - const data = message as Buffer - const msgType = proto.CoordinatorMessage.deserializeBinary(data).getType() - - if (msgType === proto.MessageType.PING) { - ws.send(data) - } else if (msgType === proto.MessageType.TOPIC) { - const topicMessage = proto.TopicMessage.deserializeBinary(data) - - const topic = topicMessage.getTopic() - - // Heartbeat - const body = topicMessage.getBody() as any - const dataHeader = DataHeader.deserializeBinary(body) - const category = dataHeader.getCategory() - if (category === Category.POSITION) { - const positionData = PositionData.deserializeBinary(body) - const lastHearbeat = connectionHeartbeats.get(ws) - const now = Date.now() - if (!lastHearbeat || lastHearbeat < now - HEARTBEAT_REFRESH_RATE) { - connectionHeartbeats.set(ws, now) - const position = positionData.toObject() - const peerPositionChange = { - id: aliasToUserId.get(alias), - position: [position.positionX, position.positionY, position.positionZ], - } - messageBroker.publish("heartbeat", peerPositionChange) - } - } - - const topicFwMessage = new proto.TopicFWMessage() - topicFwMessage.setType(proto.MessageType.TOPIC_FW) - topicFwMessage.setFromAlias(alias) - topicFwMessage.setBody(topicMessage.getBody_asU8()) - - const topicData = topicFwMessage.serializeBinary() - - messageBroker.publish("island", topicData) - } else if (msgType === proto.MessageType.TOPIC_IDENTITY) { - const topicMessage = proto.TopicIdentityMessage.deserializeBinary(data) - - const topic = topicMessage.getTopic() - - const topicFwMessage = new proto.TopicIdentityFWMessage() - topicFwMessage.setType(proto.MessageType.TOPIC_IDENTITY_FW) - topicFwMessage.setFromAlias(alias) - topicFwMessage.setIdentity(aliasToUserId.get(alias)!) - topicFwMessage.setRole(proto.Role.CLIENT) - topicFwMessage.setBody(topicMessage.getBody_asU8()) - - const topicData = topicFwMessage.serializeBinary() - - messageBroker.publish("island", topicData) - } - }) - - setTimeout(() => { - const welcome = new proto.WelcomeMessage() - welcome.setType(proto.MessageType.WELCOME) - welcome.setAlias(alias) - const data = welcome.serializeBinary() - - ws.send(data) - }, 100) - - ws.on("error", (error) => { - logger.error(error) - - const subscriptionList = getSubscriptionsList(ws) - subscriptionList.forEach((subscription: Subscription) => subscription.unsubscribe()) - - ws.close() - connections.delete(ws) - }) - - ws.on("close", () => { - logger.info("Unsubscribed from topics") - const subscriptionList = getSubscriptionsList(ws) - subscriptionList.forEach((subscription: Subscription) => subscription.unsubscribe()) - - logger.info("Websocket closed") - connections.delete(ws) - }) - }) -} diff --git a/src/controllers/proto/bff.proto b/src/controllers/proto/bff.proto new file mode 100644 index 0000000..7c9f197 --- /dev/null +++ b/src/controllers/proto/bff.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package protocol; + +enum MessageType { + UNKNOWN_MESSAGE_TYPE = 0; + HEARTBEAT = 1; + SUBSCRIPTION = 2; + TOPIC = 3; +} + +message MessageHeader { + MessageType type = 1; +} + +message HeartBeatMessage { + MessageType type = 1; + double time = 2; + bytes data = 3; +} + +// NOTE: topics is a space separated string in the format specified by Format +message SubscriptionMessage { + MessageType type = 1; + bytes topics = 2; +} + +message TopicMessage { + MessageType type = 1; + uint64 from_alias = 2; + string topic = 3; + bytes body = 4; +} diff --git a/src/controllers/proto/bff_pb.d.ts b/src/controllers/proto/bff_pb.d.ts new file mode 100644 index 0000000..d7b91b2 --- /dev/null +++ b/src/controllers/proto/bff_pb.d.ts @@ -0,0 +1,124 @@ +// package: protocol +// file: bff.proto + +import * as jspb from "google-protobuf"; + +export class MessageHeader extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MessageHeader.AsObject; + static toObject(includeInstance: boolean, msg: MessageHeader): MessageHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MessageHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MessageHeader; + static deserializeBinaryFromReader(message: MessageHeader, reader: jspb.BinaryReader): MessageHeader; +} + +export namespace MessageHeader { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + } +} + +export class HeartBeatMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getTime(): number; + setTime(value: number): void; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HeartBeatMessage.AsObject; + static toObject(includeInstance: boolean, msg: HeartBeatMessage): HeartBeatMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HeartBeatMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HeartBeatMessage; + static deserializeBinaryFromReader(message: HeartBeatMessage, reader: jspb.BinaryReader): HeartBeatMessage; +} + +export namespace HeartBeatMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + time: number, + data: Uint8Array | string, + } +} + +export class SubscriptionMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getTopics(): Uint8Array | string; + getTopics_asU8(): Uint8Array; + getTopics_asB64(): string; + setTopics(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SubscriptionMessage.AsObject; + static toObject(includeInstance: boolean, msg: SubscriptionMessage): SubscriptionMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SubscriptionMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SubscriptionMessage; + static deserializeBinaryFromReader(message: SubscriptionMessage, reader: jspb.BinaryReader): SubscriptionMessage; +} + +export namespace SubscriptionMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + topics: Uint8Array | string, + } +} + +export class TopicMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getFromAlias(): number; + setFromAlias(value: number): void; + + getTopic(): string; + setTopic(value: string): void; + + getBody(): Uint8Array | string; + getBody_asU8(): Uint8Array; + getBody_asB64(): string; + setBody(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TopicMessage.AsObject; + static toObject(includeInstance: boolean, msg: TopicMessage): TopicMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TopicMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TopicMessage; + static deserializeBinaryFromReader(message: TopicMessage, reader: jspb.BinaryReader): TopicMessage; +} + +export namespace TopicMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + fromAlias: number, + topic: string, + body: Uint8Array | string, + } +} + +export interface MessageTypeMap { + UNKNOWN_MESSAGE_TYPE: 0; + HEARTBEAT: 1; + SUBSCRIPTION: 2; + TOPIC: 3; +} + +export const MessageType: MessageTypeMap; + diff --git a/src/controllers/proto/bff_pb.js b/src/controllers/proto/bff_pb.js new file mode 100644 index 0000000..070e7cd --- /dev/null +++ b/src/controllers/proto/bff_pb.js @@ -0,0 +1,889 @@ +// source: bff.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = (function() { return this || window || global || self || Function('return this')(); }).call(null); + +goog.exportSymbol('proto.protocol.HeartBeatMessage', null, global); +goog.exportSymbol('proto.protocol.MessageHeader', null, global); +goog.exportSymbol('proto.protocol.MessageType', null, global); +goog.exportSymbol('proto.protocol.SubscriptionMessage', null, global); +goog.exportSymbol('proto.protocol.TopicMessage', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.MessageHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.MessageHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.MessageHeader.displayName = 'proto.protocol.MessageHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.HeartBeatMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.HeartBeatMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.HeartBeatMessage.displayName = 'proto.protocol.HeartBeatMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.SubscriptionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.SubscriptionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.SubscriptionMessage.displayName = 'proto.protocol.SubscriptionMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.TopicMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.TopicMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.TopicMessage.displayName = 'proto.protocol.TopicMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.MessageHeader.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.MessageHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.MessageHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.MessageHeader.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.MessageHeader} + */ +proto.protocol.MessageHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.MessageHeader; + return proto.protocol.MessageHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.MessageHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.MessageHeader} + */ +proto.protocol.MessageHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.MessageHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.MessageHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.MessageHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.MessageHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.MessageHeader.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.MessageHeader} returns this + */ +proto.protocol.MessageHeader.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.HeartBeatMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.HeartBeatMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.HeartBeatMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.HeartBeatMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.HeartBeatMessage} + */ +proto.protocol.HeartBeatMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.HeartBeatMessage; + return proto.protocol.HeartBeatMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.HeartBeatMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.HeartBeatMessage} + */ +proto.protocol.HeartBeatMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.HeartBeatMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.HeartBeatMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.HeartBeatMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.HeartBeatMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.HeartBeatMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.HeartBeatMessage} returns this + */ +proto.protocol.HeartBeatMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.HeartBeatMessage.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.HeartBeatMessage} returns this + */ +proto.protocol.HeartBeatMessage.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {!(string|Uint8Array)} + */ +proto.protocol.HeartBeatMessage.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.protocol.HeartBeatMessage.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.protocol.HeartBeatMessage.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.HeartBeatMessage} returns this + */ +proto.protocol.HeartBeatMessage.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.SubscriptionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.SubscriptionMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.SubscriptionMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.SubscriptionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + topics: msg.getTopics_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.SubscriptionMessage} + */ +proto.protocol.SubscriptionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.SubscriptionMessage; + return proto.protocol.SubscriptionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.SubscriptionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.SubscriptionMessage} + */ +proto.protocol.SubscriptionMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTopics(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.SubscriptionMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.SubscriptionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.SubscriptionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.SubscriptionMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTopics_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.SubscriptionMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.SubscriptionMessage} returns this + */ +proto.protocol.SubscriptionMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes topics = 2; + * @return {!(string|Uint8Array)} + */ +proto.protocol.SubscriptionMessage.prototype.getTopics = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes topics = 2; + * This is a type-conversion wrapper around `getTopics()` + * @return {string} + */ +proto.protocol.SubscriptionMessage.prototype.getTopics_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTopics())); +}; + + +/** + * optional bytes topics = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTopics()` + * @return {!Uint8Array} + */ +proto.protocol.SubscriptionMessage.prototype.getTopics_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTopics())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.SubscriptionMessage} returns this + */ +proto.protocol.SubscriptionMessage.prototype.setTopics = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.TopicMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.TopicMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.TopicMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.TopicMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + fromAlias: jspb.Message.getFieldWithDefault(msg, 2, 0), + topic: jspb.Message.getFieldWithDefault(msg, 3, ""), + body: msg.getBody_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.TopicMessage} + */ +proto.protocol.TopicMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.TopicMessage; + return proto.protocol.TopicMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.TopicMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.TopicMessage} + */ +proto.protocol.TopicMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFromAlias(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTopic(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBody(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.TopicMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.TopicMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.TopicMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.TopicMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getFromAlias(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getTopic(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getBody_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.TopicMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.TopicMessage} returns this + */ +proto.protocol.TopicMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 from_alias = 2; + * @return {number} + */ +proto.protocol.TopicMessage.prototype.getFromAlias = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.TopicMessage} returns this + */ +proto.protocol.TopicMessage.prototype.setFromAlias = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string topic = 3; + * @return {string} + */ +proto.protocol.TopicMessage.prototype.getTopic = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.TopicMessage} returns this + */ +proto.protocol.TopicMessage.prototype.setTopic = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional bytes body = 4; + * @return {!(string|Uint8Array)} + */ +proto.protocol.TopicMessage.prototype.getBody = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes body = 4; + * This is a type-conversion wrapper around `getBody()` + * @return {string} + */ +proto.protocol.TopicMessage.prototype.getBody_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBody())); +}; + + +/** + * optional bytes body = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBody()` + * @return {!Uint8Array} + */ +proto.protocol.TopicMessage.prototype.getBody_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBody())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.TopicMessage} returns this + */ +proto.protocol.TopicMessage.prototype.setBody = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * @enum {number} + */ +proto.protocol.MessageType = { + UNKNOWN_MESSAGE_TYPE: 0, + HEARTBEAT: 1, + SUBSCRIPTION: 2, + TOPIC: 3 +}; + +goog.object.extend(exports, proto.protocol); diff --git a/src/controllers/proto/comms.d.ts b/src/controllers/proto/comms.d.ts deleted file mode 100644 index bb58acc..0000000 --- a/src/controllers/proto/comms.d.ts +++ /dev/null @@ -1,227 +0,0 @@ -// package: protocol -// file: comms.proto - -import jspb from 'google-protobuf' - -export class AuthData extends jspb.Message { - getSignature(): string - setSignature(value: string): void - - getIdentity(): string - setIdentity(value: string): void - - getTimestamp(): string - setTimestamp(value: string): void - - getAccessToken(): string - setAccessToken(value: string): void - - serializeBinary(): Uint8Array - toObject(includeInstance?: boolean): AuthData.AsObject - static toObject(includeInstance: boolean, msg: AuthData): AuthData.AsObject - static extensions: { [key: number]: jspb.ExtensionFieldInfo } - static extensionsBinary: { - [key: number]: jspb.ExtensionFieldBinaryInfo - } - static serializeBinaryToWriter( - message: AuthData, - writer: jspb.BinaryWriter - ): void - static deserializeBinary(bytes: Uint8Array): AuthData - static deserializeBinaryFromReader( - message: AuthData, - reader: jspb.BinaryReader - ): AuthData -} - -export namespace AuthData { - export type AsObject = { - signature: string - identity: string - timestamp: string - accessToken: string - } -} - -export class DataHeader extends jspb.Message { - getCategory(): CategoryMap[keyof CategoryMap] - setCategory(value: CategoryMap[keyof CategoryMap]): void - - serializeBinary(): Uint8Array - toObject(includeInstance?: boolean): DataHeader.AsObject - static toObject( - includeInstance: boolean, - msg: DataHeader - ): DataHeader.AsObject - static extensions: { [key: number]: jspb.ExtensionFieldInfo } - static extensionsBinary: { - [key: number]: jspb.ExtensionFieldBinaryInfo - } - static serializeBinaryToWriter( - message: DataHeader, - writer: jspb.BinaryWriter - ): void - static deserializeBinary(bytes: Uint8Array): DataHeader - static deserializeBinaryFromReader( - message: DataHeader, - reader: jspb.BinaryReader - ): DataHeader -} - -export namespace DataHeader { - export type AsObject = { - category: CategoryMap[keyof CategoryMap] - } -} - -export class PositionData extends jspb.Message { - getCategory(): CategoryMap[keyof CategoryMap] - setCategory(value: CategoryMap[keyof CategoryMap]): void - - getTime(): number - setTime(value: number): void - - getPositionX(): number - setPositionX(value: number): void - - getPositionY(): number - setPositionY(value: number): void - - getPositionZ(): number - setPositionZ(value: number): void - - getRotationX(): number - setRotationX(value: number): void - - getRotationY(): number - setRotationY(value: number): void - - getRotationZ(): number - setRotationZ(value: number): void - - getRotationW(): number - setRotationW(value: number): void - - serializeBinary(): Uint8Array - toObject(includeInstance?: boolean): PositionData.AsObject - static toObject( - includeInstance: boolean, - msg: PositionData - ): PositionData.AsObject - static extensions: { [key: number]: jspb.ExtensionFieldInfo } - static extensionsBinary: { - [key: number]: jspb.ExtensionFieldBinaryInfo - } - static serializeBinaryToWriter( - message: PositionData, - writer: jspb.BinaryWriter - ): void - static deserializeBinary(bytes: Uint8Array): PositionData - static deserializeBinaryFromReader( - message: PositionData, - reader: jspb.BinaryReader - ): PositionData -} - -export namespace PositionData { - export type AsObject = { - category: CategoryMap[keyof CategoryMap] - time: number - positionX: number - positionY: number - positionZ: number - rotationX: number - rotationY: number - rotationZ: number - rotationW: number - } -} - -export class ProfileData extends jspb.Message { - getCategory(): CategoryMap[keyof CategoryMap] - setCategory(value: CategoryMap[keyof CategoryMap]): void - - getTime(): number - setTime(value: number): void - - getProfileVersion(): string - setProfileVersion(value: string): void - - serializeBinary(): Uint8Array - toObject(includeInstance?: boolean): ProfileData.AsObject - static toObject( - includeInstance: boolean, - msg: ProfileData - ): ProfileData.AsObject - static extensions: { [key: number]: jspb.ExtensionFieldInfo } - static extensionsBinary: { - [key: number]: jspb.ExtensionFieldBinaryInfo - } - static serializeBinaryToWriter( - message: ProfileData, - writer: jspb.BinaryWriter - ): void - static deserializeBinary(bytes: Uint8Array): ProfileData - static deserializeBinaryFromReader( - message: ProfileData, - reader: jspb.BinaryReader - ): ProfileData -} - -export namespace ProfileData { - export type AsObject = { - category: CategoryMap[keyof CategoryMap] - time: number - profileVersion: string - } -} - -export class ChatData extends jspb.Message { - getCategory(): CategoryMap[keyof CategoryMap] - setCategory(value: CategoryMap[keyof CategoryMap]): void - - getTime(): number - setTime(value: number): void - - getMessageId(): string - setMessageId(value: string): void - - getText(): string - setText(value: string): void - - serializeBinary(): Uint8Array - toObject(includeInstance?: boolean): ChatData.AsObject - static toObject(includeInstance: boolean, msg: ChatData): ChatData.AsObject - static extensions: { [key: number]: jspb.ExtensionFieldInfo } - static extensionsBinary: { - [key: number]: jspb.ExtensionFieldBinaryInfo - } - static serializeBinaryToWriter( - message: ChatData, - writer: jspb.BinaryWriter - ): void - static deserializeBinary(bytes: Uint8Array): ChatData - static deserializeBinaryFromReader( - message: ChatData, - reader: jspb.BinaryReader - ): ChatData -} - -export namespace ChatData { - export type AsObject = { - category: CategoryMap[keyof CategoryMap] - time: number - messageId: string - text: string - } -} - -export interface CategoryMap { - UNKNOWN: 0 - POSITION: 1 - PROFILE: 2 - CHAT: 3 - SCENE_MESSAGE: 4 -} - -export const Category: CategoryMap diff --git a/src/controllers/proto/comms.js b/src/controllers/proto/comms.js deleted file mode 100644 index 9e51f22..0000000 --- a/src/controllers/proto/comms.js +++ /dev/null @@ -1,1049 +0,0 @@ -/** - * @fileoverview - * @enhanceable - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! - -var jspb = require('google-protobuf') -var goog = jspb -var global = Function('return this')() - -goog.exportSymbol('proto.protocol.AuthData', null, global) -goog.exportSymbol('proto.protocol.Category', null, global) -goog.exportSymbol('proto.protocol.ChatData', null, global) -goog.exportSymbol('proto.protocol.DataHeader', null, global) -goog.exportSymbol('proto.protocol.PositionData', null, global) -goog.exportSymbol('proto.protocol.ProfileData', null, global) -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.protocol.AuthData = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null) -} -goog.inherits(proto.protocol.AuthData, jspb.Message) -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.protocol.AuthData.displayName = 'proto.protocol.AuthData' -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.protocol.DataHeader = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null) -} -goog.inherits(proto.protocol.DataHeader, jspb.Message) -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.protocol.DataHeader.displayName = 'proto.protocol.DataHeader' -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.protocol.PositionData = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null) -} -goog.inherits(proto.protocol.PositionData, jspb.Message) -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.protocol.PositionData.displayName = 'proto.protocol.PositionData' -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.protocol.ProfileData = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null) -} -goog.inherits(proto.protocol.ProfileData, jspb.Message) -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.protocol.ProfileData.displayName = 'proto.protocol.ProfileData' -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.protocol.ChatData = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null) -} -goog.inherits(proto.protocol.ChatData, jspb.Message) -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.protocol.ChatData.displayName = 'proto.protocol.ChatData' -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.protocol.AuthData.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.AuthData.toObject(opt_includeInstance, this) - } - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.protocol.AuthData} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - proto.protocol.AuthData.toObject = function(includeInstance, msg) { - var f, - obj = { - signature: jspb.Message.getFieldWithDefault(msg, 1, ''), - identity: jspb.Message.getFieldWithDefault(msg, 2, ''), - timestamp: jspb.Message.getFieldWithDefault(msg, 3, ''), - accessToken: jspb.Message.getFieldWithDefault(msg, 4, '') - } - - if (includeInstance) { - obj.$jspbMessageInstance = msg - } - return obj - } -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.AuthData} - */ -proto.protocol.AuthData.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes) - var msg = new proto.protocol.AuthData() - return proto.protocol.AuthData.deserializeBinaryFromReader(msg, reader) -} - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.protocol.AuthData} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.AuthData} - */ -proto.protocol.AuthData.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break - } - var field = reader.getFieldNumber() - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()) - msg.setSignature(value) - break - case 2: - var value = /** @type {string} */ (reader.readString()) - msg.setIdentity(value) - break - case 3: - var value = /** @type {string} */ (reader.readString()) - msg.setTimestamp(value) - break - case 4: - var value = /** @type {string} */ (reader.readString()) - msg.setAccessToken(value) - break - default: - reader.skipField() - break - } - } - return msg -} - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.protocol.AuthData.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter() - proto.protocol.AuthData.serializeBinaryToWriter(this, writer) - return writer.getResultBuffer() -} - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.protocol.AuthData} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.protocol.AuthData.serializeBinaryToWriter = function(message, writer) { - var f = undefined - f = message.getSignature() - if (f.length > 0) { - writer.writeString(1, f) - } - f = message.getIdentity() - if (f.length > 0) { - writer.writeString(2, f) - } - f = message.getTimestamp() - if (f.length > 0) { - writer.writeString(3, f) - } - f = message.getAccessToken() - if (f.length > 0) { - writer.writeString(4, f) - } -} - -/** - * optional string signature = 1; - * @return {string} - */ -proto.protocol.AuthData.prototype.getSignature = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')) -} - -/** @param {string} value */ -proto.protocol.AuthData.prototype.setSignature = function(value) { - jspb.Message.setProto3StringField(this, 1, value) -} - -/** - * optional string identity = 2; - * @return {string} - */ -proto.protocol.AuthData.prototype.getIdentity = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')) -} - -/** @param {string} value */ -proto.protocol.AuthData.prototype.setIdentity = function(value) { - jspb.Message.setProto3StringField(this, 2, value) -} - -/** - * optional string timestamp = 3; - * @return {string} - */ -proto.protocol.AuthData.prototype.getTimestamp = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')) -} - -/** @param {string} value */ -proto.protocol.AuthData.prototype.setTimestamp = function(value) { - jspb.Message.setProto3StringField(this, 3, value) -} - -/** - * optional string access_token = 4; - * @return {string} - */ -proto.protocol.AuthData.prototype.getAccessToken = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, '')) -} - -/** @param {string} value */ -proto.protocol.AuthData.prototype.setAccessToken = function(value) { - jspb.Message.setProto3StringField(this, 4, value) -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.protocol.DataHeader.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.DataHeader.toObject(opt_includeInstance, this) - } - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.protocol.DataHeader} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - proto.protocol.DataHeader.toObject = function(includeInstance, msg) { - var f, - obj = { - category: jspb.Message.getFieldWithDefault(msg, 1, 0) - } - - if (includeInstance) { - obj.$jspbMessageInstance = msg - } - return obj - } -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.DataHeader} - */ -proto.protocol.DataHeader.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes) - var msg = new proto.protocol.DataHeader() - return proto.protocol.DataHeader.deserializeBinaryFromReader(msg, reader) -} - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.protocol.DataHeader} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.DataHeader} - */ -proto.protocol.DataHeader.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break - } - var field = reader.getFieldNumber() - switch (field) { - case 1: - var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()) - msg.setCategory(value) - break - default: - reader.skipField() - break - } - } - return msg -} - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.protocol.DataHeader.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter() - proto.protocol.DataHeader.serializeBinaryToWriter(this, writer) - return writer.getResultBuffer() -} - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.protocol.DataHeader} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.protocol.DataHeader.serializeBinaryToWriter = function(message, writer) { - var f = undefined - f = message.getCategory() - if (f !== 0.0) { - writer.writeEnum(1, f) - } -} - -/** - * optional Category category = 1; - * @return {!proto.protocol.Category} - */ -proto.protocol.DataHeader.prototype.getCategory = function() { - return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)) -} - -/** @param {!proto.protocol.Category} value */ -proto.protocol.DataHeader.prototype.setCategory = function(value) { - jspb.Message.setProto3EnumField(this, 1, value) -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.protocol.PositionData.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.PositionData.toObject(opt_includeInstance, this) - } - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.protocol.PositionData} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - proto.protocol.PositionData.toObject = function(includeInstance, msg) { - var f, - obj = { - category: jspb.Message.getFieldWithDefault(msg, 1, 0), - time: +jspb.Message.getFieldWithDefault(msg, 2, 0.0), - positionX: +jspb.Message.getFieldWithDefault(msg, 3, 0.0), - positionY: +jspb.Message.getFieldWithDefault(msg, 4, 0.0), - positionZ: +jspb.Message.getFieldWithDefault(msg, 5, 0.0), - rotationX: +jspb.Message.getFieldWithDefault(msg, 6, 0.0), - rotationY: +jspb.Message.getFieldWithDefault(msg, 7, 0.0), - rotationZ: +jspb.Message.getFieldWithDefault(msg, 8, 0.0), - rotationW: +jspb.Message.getFieldWithDefault(msg, 9, 0.0) - } - - if (includeInstance) { - obj.$jspbMessageInstance = msg - } - return obj - } -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.PositionData} - */ -proto.protocol.PositionData.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes) - var msg = new proto.protocol.PositionData() - return proto.protocol.PositionData.deserializeBinaryFromReader(msg, reader) -} - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.protocol.PositionData} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.PositionData} - */ -proto.protocol.PositionData.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break - } - var field = reader.getFieldNumber() - switch (field) { - case 1: - var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()) - msg.setCategory(value) - break - case 2: - var value = /** @type {number} */ (reader.readDouble()) - msg.setTime(value) - break - case 3: - var value = /** @type {number} */ (reader.readFloat()) - msg.setPositionX(value) - break - case 4: - var value = /** @type {number} */ (reader.readFloat()) - msg.setPositionY(value) - break - case 5: - var value = /** @type {number} */ (reader.readFloat()) - msg.setPositionZ(value) - break - case 6: - var value = /** @type {number} */ (reader.readFloat()) - msg.setRotationX(value) - break - case 7: - var value = /** @type {number} */ (reader.readFloat()) - msg.setRotationY(value) - break - case 8: - var value = /** @type {number} */ (reader.readFloat()) - msg.setRotationZ(value) - break - case 9: - var value = /** @type {number} */ (reader.readFloat()) - msg.setRotationW(value) - break - default: - reader.skipField() - break - } - } - return msg -} - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.protocol.PositionData.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter() - proto.protocol.PositionData.serializeBinaryToWriter(this, writer) - return writer.getResultBuffer() -} - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.protocol.PositionData} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.protocol.PositionData.serializeBinaryToWriter = function(message, writer) { - var f = undefined - f = message.getCategory() - if (f !== 0.0) { - writer.writeEnum(1, f) - } - f = message.getTime() - if (f !== 0.0) { - writer.writeDouble(2, f) - } - f = message.getPositionX() - if (f !== 0.0) { - writer.writeFloat(3, f) - } - f = message.getPositionY() - if (f !== 0.0) { - writer.writeFloat(4, f) - } - f = message.getPositionZ() - if (f !== 0.0) { - writer.writeFloat(5, f) - } - f = message.getRotationX() - if (f !== 0.0) { - writer.writeFloat(6, f) - } - f = message.getRotationY() - if (f !== 0.0) { - writer.writeFloat(7, f) - } - f = message.getRotationZ() - if (f !== 0.0) { - writer.writeFloat(8, f) - } - f = message.getRotationW() - if (f !== 0.0) { - writer.writeFloat(9, f) - } -} - -/** - * optional Category category = 1; - * @return {!proto.protocol.Category} - */ -proto.protocol.PositionData.prototype.getCategory = function() { - return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)) -} - -/** @param {!proto.protocol.Category} value */ -proto.protocol.PositionData.prototype.setCategory = function(value) { - jspb.Message.setProto3EnumField(this, 1, value) -} - -/** - * optional double time = 2; - * @return {number} - */ -proto.protocol.PositionData.prototype.getTime = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 2, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setTime = function(value) { - jspb.Message.setProto3FloatField(this, 2, value) -} - -/** - * optional float position_x = 3; - * @return {number} - */ -proto.protocol.PositionData.prototype.getPositionX = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 3, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setPositionX = function(value) { - jspb.Message.setProto3FloatField(this, 3, value) -} - -/** - * optional float position_y = 4; - * @return {number} - */ -proto.protocol.PositionData.prototype.getPositionY = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 4, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setPositionY = function(value) { - jspb.Message.setProto3FloatField(this, 4, value) -} - -/** - * optional float position_z = 5; - * @return {number} - */ -proto.protocol.PositionData.prototype.getPositionZ = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 5, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setPositionZ = function(value) { - jspb.Message.setProto3FloatField(this, 5, value) -} - -/** - * optional float rotation_x = 6; - * @return {number} - */ -proto.protocol.PositionData.prototype.getRotationX = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 6, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setRotationX = function(value) { - jspb.Message.setProto3FloatField(this, 6, value) -} - -/** - * optional float rotation_y = 7; - * @return {number} - */ -proto.protocol.PositionData.prototype.getRotationY = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 7, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setRotationY = function(value) { - jspb.Message.setProto3FloatField(this, 7, value) -} - -/** - * optional float rotation_z = 8; - * @return {number} - */ -proto.protocol.PositionData.prototype.getRotationZ = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 8, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setRotationZ = function(value) { - jspb.Message.setProto3FloatField(this, 8, value) -} - -/** - * optional float rotation_w = 9; - * @return {number} - */ -proto.protocol.PositionData.prototype.getRotationW = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 9, 0.0)) -} - -/** @param {number} value */ -proto.protocol.PositionData.prototype.setRotationW = function(value) { - jspb.Message.setProto3FloatField(this, 9, value) -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.protocol.ProfileData.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.ProfileData.toObject(opt_includeInstance, this) - } - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.protocol.ProfileData} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - proto.protocol.ProfileData.toObject = function(includeInstance, msg) { - var f, - obj = { - category: jspb.Message.getFieldWithDefault(msg, 1, 0), - time: +jspb.Message.getFieldWithDefault(msg, 2, 0.0), - profileVersion: jspb.Message.getFieldWithDefault(msg, 3, '') - } - - if (includeInstance) { - obj.$jspbMessageInstance = msg - } - return obj - } -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.ProfileData} - */ -proto.protocol.ProfileData.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes) - var msg = new proto.protocol.ProfileData() - return proto.protocol.ProfileData.deserializeBinaryFromReader(msg, reader) -} - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.protocol.ProfileData} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.ProfileData} - */ -proto.protocol.ProfileData.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break - } - var field = reader.getFieldNumber() - switch (field) { - case 1: - var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()) - msg.setCategory(value) - break - case 2: - var value = /** @type {number} */ (reader.readDouble()) - msg.setTime(value) - break - case 3: - var value = /** @type {string} */ (reader.readString()) - msg.setProfileVersion(value) - break - default: - reader.skipField() - break - } - } - return msg -} - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.protocol.ProfileData.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter() - proto.protocol.ProfileData.serializeBinaryToWriter(this, writer) - return writer.getResultBuffer() -} - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.protocol.ProfileData} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.protocol.ProfileData.serializeBinaryToWriter = function(message, writer) { - var f = undefined - f = message.getCategory() - if (f !== 0.0) { - writer.writeEnum(1, f) - } - f = message.getTime() - if (f !== 0.0) { - writer.writeDouble(2, f) - } - f = message.getProfileVersion() - if (f.length > 0) { - writer.writeString(3, f) - } -} - -/** - * optional Category category = 1; - * @return {!proto.protocol.Category} - */ -proto.protocol.ProfileData.prototype.getCategory = function() { - return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)) -} - -/** @param {!proto.protocol.Category} value */ -proto.protocol.ProfileData.prototype.setCategory = function(value) { - jspb.Message.setProto3EnumField(this, 1, value) -} - -/** - * optional double time = 2; - * @return {number} - */ -proto.protocol.ProfileData.prototype.getTime = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 2, 0.0)) -} - -/** @param {number} value */ -proto.protocol.ProfileData.prototype.setTime = function(value) { - jspb.Message.setProto3FloatField(this, 2, value) -} - -/** - * optional string profile_version = 3; - * @return {string} - */ -proto.protocol.ProfileData.prototype.getProfileVersion = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')) -} - -/** @param {string} value */ -proto.protocol.ProfileData.prototype.setProfileVersion = function(value) { - jspb.Message.setProto3StringField(this, 3, value) -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.protocol.ChatData.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.ChatData.toObject(opt_includeInstance, this) - } - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.protocol.ChatData} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - proto.protocol.ChatData.toObject = function(includeInstance, msg) { - var f, - obj = { - category: jspb.Message.getFieldWithDefault(msg, 1, 0), - time: +jspb.Message.getFieldWithDefault(msg, 2, 0.0), - messageId: jspb.Message.getFieldWithDefault(msg, 3, ''), - text: jspb.Message.getFieldWithDefault(msg, 4, '') - } - - if (includeInstance) { - obj.$jspbMessageInstance = msg - } - return obj - } -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.ChatData} - */ -proto.protocol.ChatData.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes) - var msg = new proto.protocol.ChatData() - return proto.protocol.ChatData.deserializeBinaryFromReader(msg, reader) -} - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.protocol.ChatData} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.ChatData} - */ -proto.protocol.ChatData.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break - } - var field = reader.getFieldNumber() - switch (field) { - case 1: - var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()) - msg.setCategory(value) - break - case 2: - var value = /** @type {number} */ (reader.readDouble()) - msg.setTime(value) - break - case 3: - var value = /** @type {string} */ (reader.readString()) - msg.setMessageId(value) - break - case 4: - var value = /** @type {string} */ (reader.readString()) - msg.setText(value) - break - default: - reader.skipField() - break - } - } - return msg -} - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.protocol.ChatData.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter() - proto.protocol.ChatData.serializeBinaryToWriter(this, writer) - return writer.getResultBuffer() -} - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.protocol.ChatData} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.protocol.ChatData.serializeBinaryToWriter = function(message, writer) { - var f = undefined - f = message.getCategory() - if (f !== 0.0) { - writer.writeEnum(1, f) - } - f = message.getTime() - if (f !== 0.0) { - writer.writeDouble(2, f) - } - f = message.getMessageId() - if (f.length > 0) { - writer.writeString(3, f) - } - f = message.getText() - if (f.length > 0) { - writer.writeString(4, f) - } -} - -/** - * optional Category category = 1; - * @return {!proto.protocol.Category} - */ -proto.protocol.ChatData.prototype.getCategory = function() { - return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)) -} - -/** @param {!proto.protocol.Category} value */ -proto.protocol.ChatData.prototype.setCategory = function(value) { - jspb.Message.setProto3EnumField(this, 1, value) -} - -/** - * optional double time = 2; - * @return {number} - */ -proto.protocol.ChatData.prototype.getTime = function() { - return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 2, 0.0)) -} - -/** @param {number} value */ -proto.protocol.ChatData.prototype.setTime = function(value) { - jspb.Message.setProto3FloatField(this, 2, value) -} - -/** - * optional string message_id = 3; - * @return {string} - */ -proto.protocol.ChatData.prototype.getMessageId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')) -} - -/** @param {string} value */ -proto.protocol.ChatData.prototype.setMessageId = function(value) { - jspb.Message.setProto3StringField(this, 3, value) -} - -/** - * optional string text = 4; - * @return {string} - */ -proto.protocol.ChatData.prototype.getText = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, '')) -} - -/** @param {string} value */ -proto.protocol.ChatData.prototype.setText = function(value) { - jspb.Message.setProto3StringField(this, 4, value) -} - -/** - * @enum {number} - */ -proto.protocol.Category = { - UNKNOWN: 0, - POSITION: 1, - PROFILE: 2, - CHAT: 3, - SCENE_MESSAGE: 4 -} - -goog.object.extend(exports, proto.protocol) diff --git a/src/controllers/proto/comms.proto b/src/controllers/proto/comms.proto index 104cf40..9443ccd 100644 --- a/src/controllers/proto/comms.proto +++ b/src/controllers/proto/comms.proto @@ -15,6 +15,9 @@ enum Category { PROFILE = 2; CHAT = 3; SCENE_MESSAGE = 4; + PROF_REQ = 5; + PROF_RES = 6; + WORLD_POSITION= 7; } message DataHeader { @@ -31,12 +34,39 @@ message PositionData { float rotation_y = 7; float rotation_z = 8; float rotation_w = 9; + bool immediate = 10; +} + +message WorldPositionData { + Category category = 1; + double time = 2; + float position_x = 3; + float position_y = 4; + float position_z = 5; } message ProfileData { Category category = 1; double time = 2; string profile_version = 3; + enum ProfileType { + LOCAL = 0; + DEPLOYED = 1; + } + ProfileType profile_type = 4; +} + +message ProfileRequestData { + Category category = 1; + double time = 2; + string profile_version = 3; + string user_id = 4; +} + +message ProfileResponseData { + Category category = 1; + double time = 2; + string serialized_profile = 3; } message ChatData { @@ -44,4 +74,4 @@ message ChatData { double time = 2; string message_id = 3; string text = 4; -} \ No newline at end of file +} diff --git a/src/controllers/proto/comms_pb.d.ts b/src/controllers/proto/comms_pb.d.ts new file mode 100644 index 0000000..63e3be8 --- /dev/null +++ b/src/controllers/proto/comms_pb.d.ts @@ -0,0 +1,293 @@ +// package: protocol +// file: comms.proto + +import * as jspb from "google-protobuf"; + +export class AuthData extends jspb.Message { + getSignature(): string; + setSignature(value: string): void; + + getIdentity(): string; + setIdentity(value: string): void; + + getTimestamp(): string; + setTimestamp(value: string): void; + + getAccessToken(): string; + setAccessToken(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AuthData.AsObject; + static toObject(includeInstance: boolean, msg: AuthData): AuthData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AuthData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AuthData; + static deserializeBinaryFromReader(message: AuthData, reader: jspb.BinaryReader): AuthData; +} + +export namespace AuthData { + export type AsObject = { + signature: string, + identity: string, + timestamp: string, + accessToken: string, + } +} + +export class DataHeader extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DataHeader.AsObject; + static toObject(includeInstance: boolean, msg: DataHeader): DataHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DataHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DataHeader; + static deserializeBinaryFromReader(message: DataHeader, reader: jspb.BinaryReader): DataHeader; +} + +export namespace DataHeader { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + } +} + +export class PositionData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getPositionX(): number; + setPositionX(value: number): void; + + getPositionY(): number; + setPositionY(value: number): void; + + getPositionZ(): number; + setPositionZ(value: number): void; + + getRotationX(): number; + setRotationX(value: number): void; + + getRotationY(): number; + setRotationY(value: number): void; + + getRotationZ(): number; + setRotationZ(value: number): void; + + getRotationW(): number; + setRotationW(value: number): void; + + getImmediate(): boolean; + setImmediate(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PositionData.AsObject; + static toObject(includeInstance: boolean, msg: PositionData): PositionData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PositionData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PositionData; + static deserializeBinaryFromReader(message: PositionData, reader: jspb.BinaryReader): PositionData; +} + +export namespace PositionData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + positionX: number, + positionY: number, + positionZ: number, + rotationX: number, + rotationY: number, + rotationZ: number, + rotationW: number, + immediate: boolean, + } +} + +export class WorldPositionData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getPositionX(): number; + setPositionX(value: number): void; + + getPositionY(): number; + setPositionY(value: number): void; + + getPositionZ(): number; + setPositionZ(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorldPositionData.AsObject; + static toObject(includeInstance: boolean, msg: WorldPositionData): WorldPositionData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WorldPositionData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorldPositionData; + static deserializeBinaryFromReader(message: WorldPositionData, reader: jspb.BinaryReader): WorldPositionData; +} + +export namespace WorldPositionData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + positionX: number, + positionY: number, + positionZ: number, + } +} + +export class ProfileData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getProfileVersion(): string; + setProfileVersion(value: string): void; + + getProfileType(): ProfileData.ProfileTypeMap[keyof ProfileData.ProfileTypeMap]; + setProfileType(value: ProfileData.ProfileTypeMap[keyof ProfileData.ProfileTypeMap]): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProfileData.AsObject; + static toObject(includeInstance: boolean, msg: ProfileData): ProfileData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProfileData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProfileData; + static deserializeBinaryFromReader(message: ProfileData, reader: jspb.BinaryReader): ProfileData; +} + +export namespace ProfileData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + profileVersion: string, + profileType: ProfileData.ProfileTypeMap[keyof ProfileData.ProfileTypeMap], + } + + export interface ProfileTypeMap { + LOCAL: 0; + DEPLOYED: 1; + } + + export const ProfileType: ProfileTypeMap; +} + +export class ProfileRequestData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getProfileVersion(): string; + setProfileVersion(value: string): void; + + getUserId(): string; + setUserId(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProfileRequestData.AsObject; + static toObject(includeInstance: boolean, msg: ProfileRequestData): ProfileRequestData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProfileRequestData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProfileRequestData; + static deserializeBinaryFromReader(message: ProfileRequestData, reader: jspb.BinaryReader): ProfileRequestData; +} + +export namespace ProfileRequestData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + profileVersion: string, + userId: string, + } +} + +export class ProfileResponseData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getSerializedProfile(): string; + setSerializedProfile(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProfileResponseData.AsObject; + static toObject(includeInstance: boolean, msg: ProfileResponseData): ProfileResponseData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProfileResponseData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProfileResponseData; + static deserializeBinaryFromReader(message: ProfileResponseData, reader: jspb.BinaryReader): ProfileResponseData; +} + +export namespace ProfileResponseData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + serializedProfile: string, + } +} + +export class ChatData extends jspb.Message { + getCategory(): CategoryMap[keyof CategoryMap]; + setCategory(value: CategoryMap[keyof CategoryMap]): void; + + getTime(): number; + setTime(value: number): void; + + getMessageId(): string; + setMessageId(value: string): void; + + getText(): string; + setText(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ChatData.AsObject; + static toObject(includeInstance: boolean, msg: ChatData): ChatData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ChatData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ChatData; + static deserializeBinaryFromReader(message: ChatData, reader: jspb.BinaryReader): ChatData; +} + +export namespace ChatData { + export type AsObject = { + category: CategoryMap[keyof CategoryMap], + time: number, + messageId: string, + text: string, + } +} + +export interface CategoryMap { + UNKNOWN: 0; + POSITION: 1; + PROFILE: 2; + CHAT: 3; + SCENE_MESSAGE: 4; + PROF_REQ: 5; + PROF_RES: 6; + WORLD_POSITION: 7; +} + +export const Category: CategoryMap; + diff --git a/src/controllers/proto/comms_pb.js b/src/controllers/proto/comms_pb.js new file mode 100644 index 0000000..6a3a7a3 --- /dev/null +++ b/src/controllers/proto/comms_pb.js @@ -0,0 +1,2068 @@ +// source: comms.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = (function() { return this || window || global || self || Function('return this')(); }).call(null); + +goog.exportSymbol('proto.protocol.AuthData', null, global); +goog.exportSymbol('proto.protocol.Category', null, global); +goog.exportSymbol('proto.protocol.ChatData', null, global); +goog.exportSymbol('proto.protocol.DataHeader', null, global); +goog.exportSymbol('proto.protocol.PositionData', null, global); +goog.exportSymbol('proto.protocol.ProfileData', null, global); +goog.exportSymbol('proto.protocol.ProfileData.ProfileType', null, global); +goog.exportSymbol('proto.protocol.ProfileRequestData', null, global); +goog.exportSymbol('proto.protocol.ProfileResponseData', null, global); +goog.exportSymbol('proto.protocol.WorldPositionData', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.AuthData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.AuthData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.AuthData.displayName = 'proto.protocol.AuthData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.DataHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.DataHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.DataHeader.displayName = 'proto.protocol.DataHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.PositionData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.PositionData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.PositionData.displayName = 'proto.protocol.PositionData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.WorldPositionData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.WorldPositionData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.WorldPositionData.displayName = 'proto.protocol.WorldPositionData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.ProfileData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.ProfileData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.ProfileData.displayName = 'proto.protocol.ProfileData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.ProfileRequestData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.ProfileRequestData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.ProfileRequestData.displayName = 'proto.protocol.ProfileRequestData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.ProfileResponseData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.ProfileResponseData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.ProfileResponseData.displayName = 'proto.protocol.ProfileResponseData'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.ChatData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.ChatData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.ChatData.displayName = 'proto.protocol.ChatData'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.AuthData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.AuthData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.AuthData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.AuthData.toObject = function(includeInstance, msg) { + var f, obj = { + signature: jspb.Message.getFieldWithDefault(msg, 1, ""), + identity: jspb.Message.getFieldWithDefault(msg, 2, ""), + timestamp: jspb.Message.getFieldWithDefault(msg, 3, ""), + accessToken: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.AuthData} + */ +proto.protocol.AuthData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.AuthData; + return proto.protocol.AuthData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.AuthData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.AuthData} + */ +proto.protocol.AuthData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setSignature(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setIdentity(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTimestamp(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setAccessToken(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.AuthData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.AuthData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.AuthData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.AuthData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSignature(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getIdentity(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getTimestamp(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getAccessToken(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional string signature = 1; + * @return {string} + */ +proto.protocol.AuthData.prototype.getSignature = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.AuthData} returns this + */ +proto.protocol.AuthData.prototype.setSignature = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string identity = 2; + * @return {string} + */ +proto.protocol.AuthData.prototype.getIdentity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.AuthData} returns this + */ +proto.protocol.AuthData.prototype.setIdentity = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string timestamp = 3; + * @return {string} + */ +proto.protocol.AuthData.prototype.getTimestamp = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.AuthData} returns this + */ +proto.protocol.AuthData.prototype.setTimestamp = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string access_token = 4; + * @return {string} + */ +proto.protocol.AuthData.prototype.getAccessToken = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.AuthData} returns this + */ +proto.protocol.AuthData.prototype.setAccessToken = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.DataHeader.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.DataHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.DataHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.DataHeader.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.DataHeader} + */ +proto.protocol.DataHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.DataHeader; + return proto.protocol.DataHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.DataHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.DataHeader} + */ +proto.protocol.DataHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.DataHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.DataHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.DataHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.DataHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.DataHeader.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.DataHeader} returns this + */ +proto.protocol.DataHeader.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.PositionData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.PositionData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.PositionData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PositionData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + positionX: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 0.0), + positionY: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), + positionZ: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), + rotationX: jspb.Message.getFloatingPointFieldWithDefault(msg, 6, 0.0), + rotationY: jspb.Message.getFloatingPointFieldWithDefault(msg, 7, 0.0), + rotationZ: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 0.0), + rotationW: jspb.Message.getFloatingPointFieldWithDefault(msg, 9, 0.0), + immediate: jspb.Message.getBooleanFieldWithDefault(msg, 10, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.PositionData} + */ +proto.protocol.PositionData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.PositionData; + return proto.protocol.PositionData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.PositionData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.PositionData} + */ +proto.protocol.PositionData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionX(value); + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionY(value); + break; + case 5: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionZ(value); + break; + case 6: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRotationX(value); + break; + case 7: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRotationY(value); + break; + case 8: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRotationZ(value); + break; + case 9: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRotationW(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setImmediate(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.PositionData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.PositionData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.PositionData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PositionData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getPositionX(); + if (f !== 0.0) { + writer.writeFloat( + 3, + f + ); + } + f = message.getPositionY(); + if (f !== 0.0) { + writer.writeFloat( + 4, + f + ); + } + f = message.getPositionZ(); + if (f !== 0.0) { + writer.writeFloat( + 5, + f + ); + } + f = message.getRotationX(); + if (f !== 0.0) { + writer.writeFloat( + 6, + f + ); + } + f = message.getRotationY(); + if (f !== 0.0) { + writer.writeFloat( + 7, + f + ); + } + f = message.getRotationZ(); + if (f !== 0.0) { + writer.writeFloat( + 8, + f + ); + } + f = message.getRotationW(); + if (f !== 0.0) { + writer.writeFloat( + 9, + f + ); + } + f = message.getImmediate(); + if (f) { + writer.writeBool( + 10, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.PositionData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.PositionData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional float position_x = 3; + * @return {number} + */ +proto.protocol.PositionData.prototype.getPositionX = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 3, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setPositionX = function(value) { + return jspb.Message.setProto3FloatField(this, 3, value); +}; + + +/** + * optional float position_y = 4; + * @return {number} + */ +proto.protocol.PositionData.prototype.getPositionY = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setPositionY = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); +}; + + +/** + * optional float position_z = 5; + * @return {number} + */ +proto.protocol.PositionData.prototype.getPositionZ = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setPositionZ = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); +}; + + +/** + * optional float rotation_x = 6; + * @return {number} + */ +proto.protocol.PositionData.prototype.getRotationX = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setRotationX = function(value) { + return jspb.Message.setProto3FloatField(this, 6, value); +}; + + +/** + * optional float rotation_y = 7; + * @return {number} + */ +proto.protocol.PositionData.prototype.getRotationY = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 7, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setRotationY = function(value) { + return jspb.Message.setProto3FloatField(this, 7, value); +}; + + +/** + * optional float rotation_z = 8; + * @return {number} + */ +proto.protocol.PositionData.prototype.getRotationZ = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setRotationZ = function(value) { + return jspb.Message.setProto3FloatField(this, 8, value); +}; + + +/** + * optional float rotation_w = 9; + * @return {number} + */ +proto.protocol.PositionData.prototype.getRotationW = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 9, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setRotationW = function(value) { + return jspb.Message.setProto3FloatField(this, 9, value); +}; + + +/** + * optional bool immediate = 10; + * @return {boolean} + */ +proto.protocol.PositionData.prototype.getImmediate = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.protocol.PositionData} returns this + */ +proto.protocol.PositionData.prototype.setImmediate = function(value) { + return jspb.Message.setProto3BooleanField(this, 10, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.WorldPositionData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.WorldPositionData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.WorldPositionData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.WorldPositionData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + positionX: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 0.0), + positionY: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), + positionZ: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.WorldPositionData} + */ +proto.protocol.WorldPositionData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.WorldPositionData; + return proto.protocol.WorldPositionData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.WorldPositionData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.WorldPositionData} + */ +proto.protocol.WorldPositionData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionX(value); + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionY(value); + break; + case 5: + var value = /** @type {number} */ (reader.readFloat()); + msg.setPositionZ(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.WorldPositionData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.WorldPositionData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.WorldPositionData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.WorldPositionData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getPositionX(); + if (f !== 0.0) { + writer.writeFloat( + 3, + f + ); + } + f = message.getPositionY(); + if (f !== 0.0) { + writer.writeFloat( + 4, + f + ); + } + f = message.getPositionZ(); + if (f !== 0.0) { + writer.writeFloat( + 5, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.WorldPositionData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.WorldPositionData} returns this + */ +proto.protocol.WorldPositionData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.WorldPositionData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.WorldPositionData} returns this + */ +proto.protocol.WorldPositionData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional float position_x = 3; + * @return {number} + */ +proto.protocol.WorldPositionData.prototype.getPositionX = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 3, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.WorldPositionData} returns this + */ +proto.protocol.WorldPositionData.prototype.setPositionX = function(value) { + return jspb.Message.setProto3FloatField(this, 3, value); +}; + + +/** + * optional float position_y = 4; + * @return {number} + */ +proto.protocol.WorldPositionData.prototype.getPositionY = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.WorldPositionData} returns this + */ +proto.protocol.WorldPositionData.prototype.setPositionY = function(value) { + return jspb.Message.setProto3FloatField(this, 4, value); +}; + + +/** + * optional float position_z = 5; + * @return {number} + */ +proto.protocol.WorldPositionData.prototype.getPositionZ = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.WorldPositionData} returns this + */ +proto.protocol.WorldPositionData.prototype.setPositionZ = function(value) { + return jspb.Message.setProto3FloatField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.ProfileData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.ProfileData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.ProfileData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + profileVersion: jspb.Message.getFieldWithDefault(msg, 3, ""), + profileType: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.ProfileData} + */ +proto.protocol.ProfileData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.ProfileData; + return proto.protocol.ProfileData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.ProfileData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.ProfileData} + */ +proto.protocol.ProfileData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setProfileVersion(value); + break; + case 4: + var value = /** @type {!proto.protocol.ProfileData.ProfileType} */ (reader.readEnum()); + msg.setProfileType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.ProfileData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.ProfileData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.ProfileData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getProfileVersion(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getProfileType(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.protocol.ProfileData.ProfileType = { + LOCAL: 0, + DEPLOYED: 1 +}; + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.ProfileData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.ProfileData} returns this + */ +proto.protocol.ProfileData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.ProfileData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.ProfileData} returns this + */ +proto.protocol.ProfileData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional string profile_version = 3; + * @return {string} + */ +proto.protocol.ProfileData.prototype.getProfileVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ProfileData} returns this + */ +proto.protocol.ProfileData.prototype.setProfileVersion = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional ProfileType profile_type = 4; + * @return {!proto.protocol.ProfileData.ProfileType} + */ +proto.protocol.ProfileData.prototype.getProfileType = function() { + return /** @type {!proto.protocol.ProfileData.ProfileType} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {!proto.protocol.ProfileData.ProfileType} value + * @return {!proto.protocol.ProfileData} returns this + */ +proto.protocol.ProfileData.prototype.setProfileType = function(value) { + return jspb.Message.setProto3EnumField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.ProfileRequestData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.ProfileRequestData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.ProfileRequestData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileRequestData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + profileVersion: jspb.Message.getFieldWithDefault(msg, 3, ""), + userId: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.ProfileRequestData} + */ +proto.protocol.ProfileRequestData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.ProfileRequestData; + return proto.protocol.ProfileRequestData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.ProfileRequestData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.ProfileRequestData} + */ +proto.protocol.ProfileRequestData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setProfileVersion(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setUserId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.ProfileRequestData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.ProfileRequestData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.ProfileRequestData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileRequestData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getProfileVersion(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getUserId(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.ProfileRequestData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.ProfileRequestData} returns this + */ +proto.protocol.ProfileRequestData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.ProfileRequestData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.ProfileRequestData} returns this + */ +proto.protocol.ProfileRequestData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional string profile_version = 3; + * @return {string} + */ +proto.protocol.ProfileRequestData.prototype.getProfileVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ProfileRequestData} returns this + */ +proto.protocol.ProfileRequestData.prototype.setProfileVersion = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string user_id = 4; + * @return {string} + */ +proto.protocol.ProfileRequestData.prototype.getUserId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ProfileRequestData} returns this + */ +proto.protocol.ProfileRequestData.prototype.setUserId = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.ProfileResponseData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.ProfileResponseData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.ProfileResponseData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileResponseData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + serializedProfile: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.ProfileResponseData} + */ +proto.protocol.ProfileResponseData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.ProfileResponseData; + return proto.protocol.ProfileResponseData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.ProfileResponseData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.ProfileResponseData} + */ +proto.protocol.ProfileResponseData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setSerializedProfile(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.ProfileResponseData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.ProfileResponseData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.ProfileResponseData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ProfileResponseData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getSerializedProfile(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.ProfileResponseData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.ProfileResponseData} returns this + */ +proto.protocol.ProfileResponseData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.ProfileResponseData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.ProfileResponseData} returns this + */ +proto.protocol.ProfileResponseData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional string serialized_profile = 3; + * @return {string} + */ +proto.protocol.ProfileResponseData.prototype.getSerializedProfile = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ProfileResponseData} returns this + */ +proto.protocol.ProfileResponseData.prototype.setSerializedProfile = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.ChatData.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.ChatData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.ChatData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ChatData.toObject = function(includeInstance, msg) { + var f, obj = { + category: jspb.Message.getFieldWithDefault(msg, 1, 0), + time: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + messageId: jspb.Message.getFieldWithDefault(msg, 3, ""), + text: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.ChatData} + */ +proto.protocol.ChatData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.ChatData; + return proto.protocol.ChatData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.ChatData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.ChatData} + */ +proto.protocol.ChatData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.Category} */ (reader.readEnum()); + msg.setCategory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readDouble()); + msg.setTime(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMessageId(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setText(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.ChatData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.ChatData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.ChatData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.ChatData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCategory(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getTime(); + if (f !== 0.0) { + writer.writeDouble( + 2, + f + ); + } + f = message.getMessageId(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getText(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional Category category = 1; + * @return {!proto.protocol.Category} + */ +proto.protocol.ChatData.prototype.getCategory = function() { + return /** @type {!proto.protocol.Category} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.Category} value + * @return {!proto.protocol.ChatData} returns this + */ +proto.protocol.ChatData.prototype.setCategory = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional double time = 2; + * @return {number} + */ +proto.protocol.ChatData.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.ChatData} returns this + */ +proto.protocol.ChatData.prototype.setTime = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional string message_id = 3; + * @return {string} + */ +proto.protocol.ChatData.prototype.getMessageId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ChatData} returns this + */ +proto.protocol.ChatData.prototype.setMessageId = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string text = 4; + * @return {string} + */ +proto.protocol.ChatData.prototype.getText = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.protocol.ChatData} returns this + */ +proto.protocol.ChatData.prototype.setText = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * @enum {number} + */ +proto.protocol.Category = { + UNKNOWN: 0, + POSITION: 1, + PROFILE: 2, + CHAT: 3, + SCENE_MESSAGE: 4, + PROF_REQ: 5, + PROF_RES: 6, + WORLD_POSITION: 7 +}; + +goog.object.extend(exports, proto.protocol); diff --git a/src/controllers/proto/compile-protobuf.sh b/src/controllers/proto/compile-protobuf.sh new file mode 100755 index 0000000..9d2c14d --- /dev/null +++ b/src/controllers/proto/compile-protobuf.sh @@ -0,0 +1,7 @@ +protoc --plugin=../../../../../node_modules/ts-protoc-gen/bin/protoc-gen-ts --js_out="import_style=commonjs,binary:." --ts_out="." comms.proto +protoc --plugin=../../../../../node_modules/ts-protoc-gen/bin/protoc-gen-ts --js_out="import_style=commonjs,binary:." --ts_out="." ws.proto +protoc --plugin=../../../../../node_modules/ts-protoc-gen/bin/protoc-gen-ts --js_out="import_style=commonjs,binary:." --ts_out="." bff.proto + + + + diff --git a/src/controllers/proto/ws.proto b/src/controllers/proto/ws.proto new file mode 100644 index 0000000..ad1e011 --- /dev/null +++ b/src/controllers/proto/ws.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package protocol; + +enum MessageType { + UNKNOWN_MESSAGE_TYPE = 0; + WELCOME = 1; + SYSTEM = 2; + IDENTITY = 3; +} + +message WelcomeMessage { + MessageType type = 1; + uint64 alias = 2; +} + +message MessageHeader { + MessageType type = 1; +} + +message SystemMessage { + MessageType type = 1; + uint64 from_alias = 2; + bytes body = 3; +} + +message IdentityMessage { + MessageType type = 1; + uint64 from_alias = 2; + bytes identity = 3; + bytes body = 4; +} diff --git a/src/controllers/proto/ws_pb.d.ts b/src/controllers/proto/ws_pb.d.ts new file mode 100644 index 0000000..e612ff7 --- /dev/null +++ b/src/controllers/proto/ws_pb.d.ts @@ -0,0 +1,124 @@ +// package: protocol +// file: ws.proto + +import * as jspb from "google-protobuf"; + +export class WelcomeMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getAlias(): number; + setAlias(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WelcomeMessage.AsObject; + static toObject(includeInstance: boolean, msg: WelcomeMessage): WelcomeMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WelcomeMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WelcomeMessage; + static deserializeBinaryFromReader(message: WelcomeMessage, reader: jspb.BinaryReader): WelcomeMessage; +} + +export namespace WelcomeMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + alias: number, + } +} + +export class MessageHeader extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MessageHeader.AsObject; + static toObject(includeInstance: boolean, msg: MessageHeader): MessageHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MessageHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MessageHeader; + static deserializeBinaryFromReader(message: MessageHeader, reader: jspb.BinaryReader): MessageHeader; +} + +export namespace MessageHeader { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + } +} + +export class SystemMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getFromAlias(): number; + setFromAlias(value: number): void; + + getBody(): Uint8Array | string; + getBody_asU8(): Uint8Array; + getBody_asB64(): string; + setBody(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SystemMessage.AsObject; + static toObject(includeInstance: boolean, msg: SystemMessage): SystemMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SystemMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SystemMessage; + static deserializeBinaryFromReader(message: SystemMessage, reader: jspb.BinaryReader): SystemMessage; +} + +export namespace SystemMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + fromAlias: number, + body: Uint8Array | string, + } +} + +export class IdentityMessage extends jspb.Message { + getType(): MessageTypeMap[keyof MessageTypeMap]; + setType(value: MessageTypeMap[keyof MessageTypeMap]): void; + + getFromAlias(): number; + setFromAlias(value: number): void; + + getIdentity(): Uint8Array | string; + getIdentity_asU8(): Uint8Array; + getIdentity_asB64(): string; + setIdentity(value: Uint8Array | string): void; + + getBody(): Uint8Array | string; + getBody_asU8(): Uint8Array; + getBody_asB64(): string; + setBody(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentityMessage.AsObject; + static toObject(includeInstance: boolean, msg: IdentityMessage): IdentityMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentityMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentityMessage; + static deserializeBinaryFromReader(message: IdentityMessage, reader: jspb.BinaryReader): IdentityMessage; +} + +export namespace IdentityMessage { + export type AsObject = { + type: MessageTypeMap[keyof MessageTypeMap], + fromAlias: number, + identity: Uint8Array | string, + body: Uint8Array | string, + } +} + +export interface MessageTypeMap { + UNKNOWN_MESSAGE_TYPE: 0; + WELCOME: 1; + SYSTEM: 2; + IDENTITY: 3; +} + +export const MessageType: MessageTypeMap; + diff --git a/src/controllers/proto/ws_pb.js b/src/controllers/proto/ws_pb.js new file mode 100644 index 0000000..56dd7db --- /dev/null +++ b/src/controllers/proto/ws_pb.js @@ -0,0 +1,889 @@ +// source: ws.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.protocol.IdentityMessage', null, global); +goog.exportSymbol('proto.protocol.MessageHeader', null, global); +goog.exportSymbol('proto.protocol.MessageType', null, global); +goog.exportSymbol('proto.protocol.SystemMessage', null, global); +goog.exportSymbol('proto.protocol.WelcomeMessage', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.WelcomeMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.WelcomeMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.WelcomeMessage.displayName = 'proto.protocol.WelcomeMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.MessageHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.MessageHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.MessageHeader.displayName = 'proto.protocol.MessageHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.SystemMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.SystemMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.SystemMessage.displayName = 'proto.protocol.SystemMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.IdentityMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.IdentityMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.protocol.IdentityMessage.displayName = 'proto.protocol.IdentityMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.WelcomeMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.WelcomeMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.WelcomeMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.WelcomeMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + alias: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.WelcomeMessage} + */ +proto.protocol.WelcomeMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.WelcomeMessage; + return proto.protocol.WelcomeMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.WelcomeMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.WelcomeMessage} + */ +proto.protocol.WelcomeMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAlias(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.WelcomeMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.WelcomeMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.WelcomeMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.WelcomeMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getAlias(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.WelcomeMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.WelcomeMessage} returns this + */ +proto.protocol.WelcomeMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 alias = 2; + * @return {number} + */ +proto.protocol.WelcomeMessage.prototype.getAlias = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.WelcomeMessage} returns this + */ +proto.protocol.WelcomeMessage.prototype.setAlias = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.MessageHeader.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.MessageHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.MessageHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.MessageHeader.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.MessageHeader} + */ +proto.protocol.MessageHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.MessageHeader; + return proto.protocol.MessageHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.MessageHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.MessageHeader} + */ +proto.protocol.MessageHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.MessageHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.MessageHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.MessageHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.MessageHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.MessageHeader.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.MessageHeader} returns this + */ +proto.protocol.MessageHeader.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.SystemMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.SystemMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.SystemMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.SystemMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + fromAlias: jspb.Message.getFieldWithDefault(msg, 2, 0), + body: msg.getBody_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.SystemMessage} + */ +proto.protocol.SystemMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.SystemMessage; + return proto.protocol.SystemMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.SystemMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.SystemMessage} + */ +proto.protocol.SystemMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFromAlias(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBody(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.SystemMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.SystemMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.SystemMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.SystemMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getFromAlias(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getBody_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.SystemMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.SystemMessage} returns this + */ +proto.protocol.SystemMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 from_alias = 2; + * @return {number} + */ +proto.protocol.SystemMessage.prototype.getFromAlias = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.SystemMessage} returns this + */ +proto.protocol.SystemMessage.prototype.setFromAlias = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes body = 3; + * @return {!(string|Uint8Array)} + */ +proto.protocol.SystemMessage.prototype.getBody = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes body = 3; + * This is a type-conversion wrapper around `getBody()` + * @return {string} + */ +proto.protocol.SystemMessage.prototype.getBody_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBody())); +}; + + +/** + * optional bytes body = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBody()` + * @return {!Uint8Array} + */ +proto.protocol.SystemMessage.prototype.getBody_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBody())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.SystemMessage} returns this + */ +proto.protocol.SystemMessage.prototype.setBody = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.IdentityMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.IdentityMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.IdentityMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.IdentityMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + fromAlias: jspb.Message.getFieldWithDefault(msg, 2, 0), + identity: msg.getIdentity_asB64(), + body: msg.getBody_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.IdentityMessage} + */ +proto.protocol.IdentityMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.IdentityMessage; + return proto.protocol.IdentityMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.IdentityMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.IdentityMessage} + */ +proto.protocol.IdentityMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.protocol.MessageType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFromAlias(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdentity(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBody(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.IdentityMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.IdentityMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.IdentityMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.IdentityMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getFromAlias(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getIdentity_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getBody_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional MessageType type = 1; + * @return {!proto.protocol.MessageType} + */ +proto.protocol.IdentityMessage.prototype.getType = function() { + return /** @type {!proto.protocol.MessageType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.protocol.MessageType} value + * @return {!proto.protocol.IdentityMessage} returns this + */ +proto.protocol.IdentityMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 from_alias = 2; + * @return {number} + */ +proto.protocol.IdentityMessage.prototype.getFromAlias = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.protocol.IdentityMessage} returns this + */ +proto.protocol.IdentityMessage.prototype.setFromAlias = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes identity = 3; + * @return {!(string|Uint8Array)} + */ +proto.protocol.IdentityMessage.prototype.getIdentity = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes identity = 3; + * This is a type-conversion wrapper around `getIdentity()` + * @return {string} + */ +proto.protocol.IdentityMessage.prototype.getIdentity_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdentity())); +}; + + +/** + * optional bytes identity = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdentity()` + * @return {!Uint8Array} + */ +proto.protocol.IdentityMessage.prototype.getIdentity_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdentity())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.IdentityMessage} returns this + */ +proto.protocol.IdentityMessage.prototype.setIdentity = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional bytes body = 4; + * @return {!(string|Uint8Array)} + */ +proto.protocol.IdentityMessage.prototype.getBody = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes body = 4; + * This is a type-conversion wrapper around `getBody()` + * @return {string} + */ +proto.protocol.IdentityMessage.prototype.getBody_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBody())); +}; + + +/** + * optional bytes body = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBody()` + * @return {!Uint8Array} + */ +proto.protocol.IdentityMessage.prototype.getBody_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBody())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.protocol.IdentityMessage} returns this + */ +proto.protocol.IdentityMessage.prototype.setBody = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * @enum {number} + */ +proto.protocol.MessageType = { + UNKNOWN_MESSAGE_TYPE: 0, + WELCOME: 1, + SYSTEM: 2, + IDENTITY: 3 +}; + +goog.object.extend(exports, proto.protocol); diff --git a/src/controllers/routes.ts b/src/controllers/routes.ts index b3f55e1..260ebfe 100644 --- a/src/controllers/routes.ts +++ b/src/controllers/routes.ts @@ -3,7 +3,6 @@ import { GlobalContext } from "../types" import { pingHandler } from "./handlers/ping-handler" import { statusHandler } from "./handlers/status-handler" import { websocketHandler } from "./handlers/ws-handler" -import { websocketRoomsHandler } from "./handlers/ws-rooms-handler" import { websocketRoomHandler } from "./handlers/ws-room-handler" // We return the entire router because it will be easier to test than a whole server @@ -14,7 +13,6 @@ export async function setupRouter(globalContext: GlobalContext): Promise