Skip to content

anaryshkin/fcm-mock-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FCM Mock Server GO (docker)

Simple FCM mock for both old fcm HTTP and HTTP v1 Image for this repo on DockerHub

Quick start

To run in docker simply run this:

docker run -p 4004:4004 -d andruxxxa/fcm-mock-server-go

The docker exposes one port - 4004.

To run localy just:

go run main.go

API

Endpoints:

  • POST /send - send message to the mock (200 response) - old HTTP
  • POST /v1/projects/[project_id]/messages:send - send message to the mock (200 response) - HTTP V1
  • GET /api/messages - returns (as JSON) history of FCM API calls to this mock
  • DELETE /api/messages - clear messages history

Message model

Old HTTP

{
    "to": "string",    // device token or topic
    "data": {       // [string]string dictionary
        "field1": "value1",
	    "field2": "value2",
        ...
    },
    "notification": {
        "title": "title",
        "body": "body"
    }
}

HTTP V1

{
    "Message": {
        "token": "string",    
        "topic" : "string",
        "condition" : "string",
        "data": {       // [string]string dictionary
            "field1": "value1",
            "field2": "value2",
            ...
        },
        "notification": {
            "title": "string",
            "body": "string"
        }
    }
}

test.http

Simple test requests - work with REST client

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published