Skip to content

Instantly share code, notes, and snippets.

@muminoff
Last active February 20, 2016 14:48
Show Gist options
  • Select an option

  • Save muminoff/1997b16d60a3d68352aa to your computer and use it in GitHub Desktop.

Select an option

Save muminoff/1997b16d60a3d68352aa to your computer and use it in GitHub Desktop.

API server (api.drivers.uz)

URL: api.drivers.uz

Protocol: HTTPS

Port: 443 (default)

SSL: enabled

Auth timeout: not set

Signup

Clients must sign up if they don't exist in system.

Endpoint: /sign_up

Method: POST

Parameters:

key type length required
phone_number string 15 yes
username string 16 yes
gcm_token text - yes
device_type string 8 yes

Chat server (chat.drivers.uz)

URL: chat.drivers.uz

Protocol: socket.io

Port: 443 (default)

SSL: enabled

Auth timeout: 60 seconds

Authentication

Clients must provide authentication credentials before proceeding to receive and emit data in communication channels.

Request

Channel signin_request

key type length required
token string 32 yes

Example

{
	"token": "446f8da7c5904653bec11557c3416f6f"
}

Response

Channel signin_response

key type success failure
status string ok fail

Example

Success response

{
	"status": "ok"
}

Failure response

{
	"status": "fail",
	"data": "token not given"
}

Failure response

{
	"status": "fail",
	"data": "invalid token"
}

Messaging

Clients can listen and emit to messaging channel any time. Bidirectional communication supported.

Request

Channel message_events

key type length required
stamp_id text not set no
topic_id int not set yes
body text not set yes
reply_to int not set no
attrs json not set no
has_media bool not set no

Example

{
	"stamp_id": "123ABC",
	"topic_id": 1,
	"body": "foobar",
	"reply_to": null,
	"attrs": null,
	"has_media": false
}

Response

Channel message_events

key type success failure
event_type text sent fail
data json json -

Example

{
	"event_type": "sent",
	"data": {
		"id": 5357,
		"stamp_id": "6D0F4Z15",
		"topic_id": 49,
		"owner": {
			"id": 15,
			"username": "Sardor"
		},
		"reply_to": null,
		"body": "foobar",
		"attrs": null,
		"sent_at": 1455667133264,
		"has_media": false
	}
}

Typing indicator

Clients must inform typing event with their id and topic id.

Request

Channel typing_event

key type length required
user_id int not set yes
topic_id int not set yes

Example

{
	"user_id": 1,
	"topic_id": 12
}

Response

Channel typing_event

key type success failure
staus text - fail
data json - json

Broadcast

Channel typing_event

key type length always
user_id int not set yes
topic_id int not set yes

Example

{
	"user_id": 1,
	"topic_id": 12
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment