extends Node const WSMessage = preload("WSMessage.gd") const IntPoint = preload("IntPoint.gd") const CreateIntPointRequest = preload("CreateIntPointRequest.gd") const CreateIntPointResponse = preload("CreateIntPointResponse.gd") const ReadIntPointRequest = preload("ReadIntPointRequest.gd") const ReadIntPointResponse = preload("ReadIntPointResponse.gd") const UpdateIntPointRequest = preload("UpdateIntPointRequest.gd") const UpdateIntPointResponse = preload("UpdateIntPointResponse.gd") const UpdateSetIntPointRequest = preload("UpdateSetIntPointRequest.gd") const UpdateSetIntPointResponse = preload("UpdateSetIntPointResponse.gd") const DeleteIntPointRequest = preload("DeleteIntPointRequest.gd") const DeleteIntPointsRequest = preload("DeleteIntPointsRequest.gd") const DeleteIntPointResponse = preload("DeleteIntPointResponse.gd") # connects the service to messaging system and websocket func _init(): Messaging.registerPublisher("/IntPointService/Create", self, "Create") Websocket.registerReceiver("IntPointService:Create", self) Messaging.subscribe("/IntPointService/do_Create", self, "Create") Messaging.registerPublisher("/IntPointService/Read", self, "Read") Websocket.registerReceiver("IntPointService:Read", self) Messaging.subscribe("/IntPointService/do_Read", self, "Read") Messaging.registerPublisher("/IntPointService/Update", self, "Update") Websocket.registerReceiver("IntPointService:Update", self) Messaging.subscribe("/IntPointService/do_Update", self, "Update") Messaging.registerPublisher("/IntPointService/Delete", self, "Delete") Websocket.registerReceiver("IntPointService:Delete", self) Messaging.subscribe("/IntPointService/do_Delete", self, "Delete") func receive(target, Out): match target: "IntPointService:Create": emit_signal("Create", Out) "IntPointService:Read": emit_signal("Read", Out) "IntPointService:Update": emit_signal("Update", Out) "IntPointService:Delete": emit_signal("Delete", Out) signal Create(Out) func Create(In : CreateIntPointRequest): Websocket.send("POST","/v1/point",{"payload": In.Payload}, "IntPointService:Create") signal Read(Out) func Read(In : ReadIntPointRequest): Websocket.send("GET","/v1/point/"+str(In.Id),{"id": In.Id,"fields": In.Fields}, "IntPointService:Read") signal Update(Out) func Update(In : UpdateIntPointRequest): Websocket.send("PATCH","/v1/point/"+str(In.Payload.Id),{"payload": In.Payload,"gerogeriGegege": In.GerogeriGegege}, "IntPointService:Update") signal Delete(Out) func Delete(In : DeleteIntPointRequest): Websocket.send("DELETE","/v1/point/"+str(In.Id),{"id": In.Id}, "IntPointService:Delete")