Skip to content

Commit

Permalink
Add realtime envelope and dispatch presence events. (heroiclabs#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Apr 22, 2018
1 parent e02f8e4 commit cb3afd7
Show file tree
Hide file tree
Showing 10 changed files with 524 additions and 111 deletions.
18 changes: 15 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"net/url"

_ "github.com/lib/pq"
"github.com/golang/protobuf/jsonpb"
)

var (
Expand Down Expand Up @@ -69,12 +70,23 @@ func main() {
// Check migration status and log if the schema has diverged.
cmd.MigrationStartupCheck(multiLogger, db)

// Shared utility components.
jsonpbMarshaler := &jsonpb.Marshaler{
EnumsAsInts: true,
EmitDefaults: false,
Indent: "",
OrigName: false,
}
jsonpbUnmarshaler := &jsonpb.Unmarshaler{
AllowUnknownFields: false,
}

// Start up server components.
registry := server.NewSessionRegistry()
tracker := server.StartLocalTracker(jsonLogger, registry, config.GetName())
router := server.NewLocalMessageRouter(registry, tracker)
tracker := server.StartLocalTracker(jsonLogger, registry, jsonpbMarshaler, config.GetName())
router := server.NewLocalMessageRouter(registry, tracker, jsonpbMarshaler)
pipeline := server.NewPipeline(config, db, tracker, router, registry)
apiServer := server.StartApiServer(jsonLogger, db, config, tracker, registry, pipeline)
apiServer := server.StartApiServer(jsonLogger, db, config, tracker, registry, pipeline, jsonpbMarshaler, jsonpbUnmarshaler)

// Respect OS stop signals.
c := make(chan os.Signal, 2)
Expand Down
1 change: 0 additions & 1 deletion migrations/20180103142000_initial_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ CREATE TABLE IF NOT EXISTS users (
edge_count INT DEFAULT 0 CHECK (edge_count >= 0) NOT NULL,
created_at BIGINT CHECK (created_at > 0) NOT NULL,
updated_at BIGINT CHECK (updated_at > 0) NOT NULL,
verified_at BIGINT CHECK (verified_at >= 0) DEFAULT 0 NOT NULL,
disabled_at BIGINT CHECK (disabled_at >= 0) DEFAULT 0 NOT NULL
);

Expand Down
4 changes: 2 additions & 2 deletions migrations/embedded.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cb3afd7

Please sign in to comment.