diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f34dd46..2f57b9f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,8 +4,12 @@
-
+
+
+
+
+
@@ -152,7 +156,6 @@
-
@@ -177,7 +180,8 @@
-
+
+
true
diff --git a/go.mod b/go.mod
index 316b350..1d55669 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ toolchain go1.22.1
require (
firebase.google.com/go v3.13.0+incompatible
- git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65
+ git.solsynth.dev/hydrogen/dealer v0.0.0-20240720114704-037fc8a18c60
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745
github.com/go-playground/validator/v10 v10.17.0
github.com/gofiber/fiber/v2 v2.52.4
diff --git a/go.sum b/go.sum
index 7c73c8a..eff0af9 100644
--- a/go.sum
+++ b/go.sum
@@ -21,6 +21,8 @@ git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a h1:08YaBgZtk
git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA=
git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65 h1:p9PIsp5RyrLdlOR7MXyeGBx04v3+1IMEEBBV22fJZPo=
git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA=
+git.solsynth.dev/hydrogen/dealer v0.0.0-20240720114704-037fc8a18c60 h1:cy58ybsaMHX8lVoCa3bsWkwQGxD4sPmMAMsVYg42kqU=
+git.solsynth.dev/hydrogen/dealer v0.0.0-20240720114704-037fc8a18c60/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA=
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 h1:40BUsQMNXjqHyytkyF9py1HjTAWlRgO6R57YXUrHNy4=
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
diff --git a/pkg/internal/grpc/server.go b/pkg/internal/grpc/server.go
index a156a3b..f1509e1 100644
--- a/pkg/internal/grpc/server.go
+++ b/pkg/internal/grpc/server.go
@@ -1,20 +1,22 @@
package grpc
import (
- "google.golang.org/grpc/reflection"
"net"
+ "google.golang.org/grpc/reflection"
+
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"github.com/spf13/viper"
"google.golang.org/grpc"
-)
-import health "google.golang.org/grpc/health/grpc_health_v1"
+ health "google.golang.org/grpc/health/grpc_health_v1"
+)
type Server struct {
proto.UnimplementedAuthServer
proto.UnimplementedNotifierServer
proto.UnimplementedRealmServer
+ proto.UnimplementedStreamControllerServer
health.UnimplementedHealthServer
srv *grpc.Server
@@ -28,6 +30,7 @@ func NewServer() *Server {
proto.RegisterAuthServer(server.srv, server)
proto.RegisterNotifierServer(server.srv, server)
proto.RegisterRealmServer(server.srv, server)
+ proto.RegisterStreamControllerServer(server.srv, server)
health.RegisterHealthServer(server.srv, server)
reflection.Register(server.srv)
diff --git a/pkg/internal/grpc/stream.go b/pkg/internal/grpc/stream.go
new file mode 100644
index 0000000..5af4e71
--- /dev/null
+++ b/pkg/internal/grpc/stream.go
@@ -0,0 +1,21 @@
+package grpc
+
+import (
+ "context"
+ "git.solsynth.dev/hydrogen/dealer/pkg/proto"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+)
+
+func (v *Server) EmitStreamEvent(ctx context.Context, request *proto.StreamEventRequest) (*proto.StreamEventResponse, error) {
+ switch request.GetEvent() {
+ case "ClientRegister":
+ // No longer need update user online status
+ // Based on realtime sever connection status
+ break
+ case "ClientUnregister":
+ // Update user last seen at
+ _ = services.SetAccountLastSeen(uint(request.GetUserId()))
+ }
+
+ return &proto.StreamEventResponse{}, nil
+}