This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "grpc_stream_medium/server/sensorpb" | |
| "log" | |
| "net" | |
| "google.golang.org/grpc" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type SensorServer interface { | |
| TempSensor(*SensorRequest, Sensor_TempSensorServer) error | |
| HumiditySensor(*SensorRequest, Sensor_HumiditySensorServer) error | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type server struct{} | |
| func (*server) TempSensor(req *sensorpb.SensorRequest, | |
| stream sensorpb.Sensor_TempSensorServer) error { | |
| return nil | |
| } | |
| func (*server) HumiditySensor(req *sensorpb.SensorRequest, | |
| stream sensorpb.Sensor_HumiditySensorServer) error { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sensor | |
| import ( | |
| "log" | |
| "math/rand" | |
| "sync" | |
| "time" | |
| ) | |
| type Sensor struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "grpc_stream_medium/server/sensor" | |
| "grpc_stream_medium/server/sensorpb" | |
| "log" | |
| "net" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protoc sensor.proto \ | |
| --js_out=import_style=commonjs,binary:./../js-client/src/sensorpb \ | |
| --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./../js-client/src/sensorpb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import './App.css'; | |
| function App() { | |
| return ( | |
| ); | |
| } | |
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| admin: | |
| access_log_path: /tmp/admin_access.log | |
| address: | |
| socket_address: { address: 0.0.0.0, port_value: 9901 } | |
| static_resources: | |
| listeners: | |
| - name: listener_0 | |
| address: | |
| socket_address: { address: 0.0.0.0, port_value: 8000 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM envoyproxy/envoy:v1.12.2 | |
| COPY ./envoy.yaml /etc/envoy/envoy.yaml | |
| CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SensorRequest , SensorResponse } from "./sensorpb/sensor_pb" | |
| import { SensorClient} from "./sensorpb/sensor_grpc_web_pb" | |
| var client = new SensorClient('http://localhost:8000') |