Skip to content

django-frog/geo_tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Item Tracking Service

A Go-based real-time tracking service using WebSocket, gRPC, and Redis for persistent geolocation data.

Features

  • WebSocket API to receive live position updates from clients.
  • gRPC API for backend services to retrieve current positions.
  • Redis storage for fast reads and writes.
  • Thread-safe client connection management.
  • Basic error handling and logging.

Requirements

  • Go 1.21+
  • Redis 7+
  • Protocol Buffers Compiler (protoc)

Installation

git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>
go mod tidy

Configuration

Set the required environment variables:

export REDIS_ADDR="localhost:6379"
export REDIS_PASSWORD="yourpassword"
export GRPC_PORT="50051"
export WS_PORT="8080"

Running the Service

go run cmd/server/main.go

WebSocket Usage

  1. Connect to: ws://localhost:8080/ws
  2. Send handshake JSON:
{
    "item_id": "your-item-id"
}
  1. Send position updates:
{
    "latitude": 35.6895,
    "longitude": 139.6917
}

gRPC Usage

The gRPC service exposes:

  • GetCurrentPosition — Retrieve the latest position for an item.

Example gRPC call in Go:

resp, err := client.GetCurrentPosition(ctx, &pb.ItemRequest{ItemId: "your-item-id"})
if err != nil {
    log.Fatal(err)
}
fmt.Println(resp)

Versioning

Current release: v0.1.0
Following Semantic Versioning.

License

MIT License

About

Geo-locational Tracking Service

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages