# Issue seen with websocket connection

**URL:** https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411
**Category:** Troubleshooting
**Created:** [March 22, 2021, 6:19pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411 "2021-03-22T18:19:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![attzonko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/attzonko/32/1335_2.png) [@attzonko](https://forum.mattermost.com/u/attzonko)
#### Post date: [March 22, 2021, 6:19pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/1 "2021-03-22T18:19:23Z")

</div>

#### Summary

Seeing an issue with websocket connections keepalive (ping/pong)

#### Steps to reproduce

Send a ping FRAME with arbitrary data payload.

#### Expected behavior

Server should not try and decode the data payload in the ping

#### Observed behavior

Serve reports an error

```auto
{"level":"debug","ts":1616436915.28949,"caller":"app/web_conn.go:202","msg":"Error while reading message from websocket","error":"error during decoding websocket message: invalid character 'Ð' looking for beginning of value","errorVerbose":"invalid character 'Ð' looking for beginning of value\nerror during decoding websocket message\ngithub.com/mattermost/mattermost-server/v5/app.(*WebConn).ReadMsg\n\tgithub.com/mattermost/mattermost-server/v5/app/web_conn.go:269\ngithub.com/mattermost/mattermost-server/v5/app.(*WebConn).startPoller.func1.1\n\tgithub.com/mattermost/mattermost-server/v5/app/web_conn.go:200\nruntime.goexit\n\truntime/asm_amd64.s:1374"}

```

---

<div class="post-metadata">

### Author: ![attzonko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/attzonko/32/1335_2.png) [@attzonko](https://forum.mattermost.com/u/attzonko)
#### Post date: [March 22, 2021, 6:20pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/2 "2021-03-22T18:20:54Z")

</div>

Here is the `ping()` frame sent from the client:

```auto
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=9, data=b'\xd0\xe2M\xd4', rsv1=False, rsv2=False, rsv3=False)
client ! timed out waiting for pong

```

By the way this was reproduced using the latest Team edition version 5.33.1

---

<div class="post-metadata">

### Author: ![attzonko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/attzonko/32/1335_2.png) [@attzonko](https://forum.mattermost.com/u/attzonko)
#### Post date: [March 22, 2021, 6:22pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/3 "2021-03-22T18:22:18Z")

</div>

For more info please take a look at these issues on Github:

> <https://github.com/aaugustin/websockets/issues/922>
>
> Hello, I think we are seeing an issue where the ping frame trying to keep the connection alive, might be possibly...

> <https://github.com/Vaelor/python-mattermost-driver/issues/79>
>
> Hi, we are using this driver for our bot code, and are seeing some weird behavior (See details here: attzonko/mmpy\_bot#171)
> On the...

> <https://github.com/attzonko/mmpy_bot/issues/171>
>
> Describe the bug
> I am seeing a weird issue on a fresh install where after a few seconds of the bot running...

---

<div class="post-metadata">

### Author: ![attzonko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/attzonko/32/1335_2.png) [@attzonko](https://forum.mattermost.com/u/attzonko)
#### Post date: [March 22, 2021, 6:30pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/4 "2021-03-22T18:30:31Z")

</div>

Confirmed that the issue is not present in 5.32.1

Here is the log from the working `ping/pong` using that version

```auto
client > Frame(fin=True, opcode=9, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=9, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
client - event = data_received(<6 bytes>)
DEBUG:websockets.protocol:client - event = data_received(<6 bytes>)
client < Frame(fin=True, opcode=10, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=10, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
client - received solicited pong: a237d008
DEBUG:websockets.protocol:client - received solicited pong: a237d008

```

---

<div class="post-metadata">

### Author: ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)
#### Post date: [March 22, 2021, 6:34pm UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/5 "2021-03-22T18:34:07Z")

</div>

FYI on this @agnivade ^

Related Github issue [Websocket handling: client side pings kill ws-connection. · Issue #17197 · mattermost/mattermost-server · GitHub](https://github.com/mattermost/mattermost-server/issues/17197)

---

<div class="post-metadata">

### Author: ![agnivade](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agnivade/32/3846_2.png) [@agnivade](https://forum.mattermost.com/u/agnivade)
#### Post date: [March 23, 2021, 3:41am UTC](https://forum.mattermost.com/t/issue-seen-with-websocket-connection/11411/6 "2021-03-23T03:41:50Z")

</div>

Thanks for the report @attzonko ! I have replied in the linked GitHub issue.
