Today the REST APIs are returning with spaces and line-breakers. We could remove everything and reduce the payload size with that.
Example of commands API:
{"commands":[{"command":"invite-all-from","clientOnly":false},{"command":"slackbridge-import","clientOnly":false},{"command":"gimme","params":"your_message_optional","description":"Slash_Gimme_Description","clientOnly":false},{"command":"lennyface","params":"your_message_optional","description":"Slash_LennyFace_Description","clientOnly":false},{"command":"shrug","params":"your_message_optional","description":"Slash_Shrug_Description","clientOnly":false},{"command":"tableflip","params":"your_message_optional","description":"Slash_Tableflip_Description","clientOnly":false},{"command":"unflip","params":"your_message_optional","description":"Slash_TableUnflip_Description","clientOnly":false},{"command":"create","clientOnly":false},{"command":"help","clientOnly":false},{"command":"invite","clientOnly":false},{"command":"invite-all-to","clientOnly":false},{"command":"archive","clientOnly":false},{"command":"join","clientOnly":false},{"command":"kick","clientOnly":false},{"command":"leave","clientOnly":false},{"command":"part","clientOnly":false},{"command":"me","params":"your_message","description":"Displays_action_text","clientOnly":false},{"command":"msg","clientOnly":false},{"command":"mute","clientOnly":false},{"command":"unmute","clientOnly":false},{"command":"topic","params":"Slash_Topic_Params","description":"Slash_Topic_Description","clientOnly":false},{"command":"unarchive","clientOnly":false}],"offset":0,"count":22,"total":22,"success":true,"developerWarning":"[WARNING]: The \"usernames\" field has been removed for performance reasons. Please use the \"*.members\" endpoint to get a list of members/users in a room."}
{
"commands": [
{
"command": "invite-all-from",
"clientOnly": false
},
{
"command": "slackbridge-import",
"clientOnly": false
},
{
"command": "gimme",
"params": "your_message_optional",
"description": "Slash_Gimme_Description",
"clientOnly": false
},
{
"command": "lennyface",
"params": "your_message_optional",
"description": "Slash_LennyFace_Description",
"clientOnly": false
},
{
"command": "shrug",
"params": "your_message_optional",
"description": "Slash_Shrug_Description",
"clientOnly": false
},
{
"command": "tableflip",
"params": "your_message_optional",
"description": "Slash_Tableflip_Description",
"clientOnly": false
},
{
"command": "unflip",
"params": "your_message_optional",
"description": "Slash_TableUnflip_Description",
"clientOnly": false
},
{
"command": "create",
"clientOnly": false
},
{
"command": "help",
"clientOnly": false
},
{
"command": "invite",
"clientOnly": false
},
{
"command": "invite-all-to",
"clientOnly": false
},
{
"command": "archive",
"clientOnly": false
},
{
"command": "join",
"clientOnly": false
},
{
"command": "kick",
"clientOnly": false
},
{
"command": "leave",
"clientOnly": false
},
{
"command": "part",
"clientOnly": false
},
{
"command": "me",
"params": "your_message",
"description": "Displays_action_text",
"clientOnly": false
},
{
"command": "msg",
"clientOnly": false
},
{
"command": "mute",
"clientOnly": false
},
{
"command": "unmute",
"clientOnly": false
},
{
"command": "topic",
"params": "Slash_Topic_Params",
"description": "Slash_Topic_Description",
"clientOnly": false
},
{
"command": "unarchive",
"clientOnly": false
}
],
"offset": 0,
"count": 22,
"total": 22,
"success": true,
"developerWarning": "[WARNING]: The \"usernames\" field has been removed for performance reasons. Please use the \"*.members\" endpoint to get a list of members/users in a room."
}
TODO: prettyJson = NODE_ENV !== 'production';
I would like to be assigned on this one.
@anuardaher feel free to submit a pull request to add this functionality. :+1:
I'd like to work on this issue. Could we gZip the incoming JSON response to compress it down?
No. We will leave the gzipping to the web server, such as caddy or ngnix or Apache.
But feel free to submit the pull request for what the issue here describes. 馃憤馃徏
Is the ngnix(/caddy/Apache) configuration already done in the repo? I couldn't pinpoint the code suggesting that.
Also, you mean that gzipping will be left to the server, the issue only requires, say, configuration of something like ngnix, and we're good to go?
You are over thinking it 馃榿
Basically the idea is turn pretty print off and let reverse proxies take care of compression. In the API declaration there is a property to enable pretty print. So just flipping it off if node_env=production is all that's needed :)
@geekgonecrazy thank you. I wanted to say something but didn't as I'm pretty grumpy today.
as that song goes, "you took the words right out of my mouth"
@geekgonecrazy Yep, I got that but I thought maybe I was oversimplifying it :P
So I was looking for API declaration in the code and failed to find any. Could you please direct me to the piece of code I might be missing?
Nevermind, I figured it out. Here is a PR regarding the same.
Just about the time I referenced this PR, I noticed that @graywolf336 worked on the same issue as well :D #9070
Most helpful comment
@geekgonecrazy thank you. I wanted to say something but didn't as I'm pretty grumpy today.
as that song goes, "you took the words right out of my mouth"