# Websocket input client threw expection

**URL:** <https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917>\
**Category:** Logstash\
**Created:** [June 10, 2019, 5:08am UTC](https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917 "2019-06-10T05:08:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smack\_Alpha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smack_alpha/32/43660_2.png) [@Smack\_Alpha](https://discuss.elastic.co/u/Smack_Alpha)\
**Post date:** [June 10, 2019, 5:08am UTC](https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917/1 "2019-06-10T05:08:51Z")

</div>

**I am using the websocket input plugin of logstash. I am using data from the websocket to be indexed on Elasticsearch. But it throws me a error. I tried some answers on your forum. Eventhough it fails. Help me with some solutions. Tell me the format of data where the web socket accepts...Give me some examples...In the logstash docs, the data format is not there....**

**This is the input from the websocket. It goes on...**

> ```
> {
> "March 14 2019, 18:51:09": {
> "monitor.status": " UP",
> "monitor.id": "icmp@icmp-ip@192.168.1.66",
> "beat.hostname": "smackcoders",
> "monitor.duration.us": 148709,
> "beat.name": "smackcoders",
> "host.os.codename": "xenial",
> "host.containerised": false,
> "host.os.version": "16.04",
> "host.id": "556b837c93cd4b8dbd3a1c01f468d8f4",
> "a": "steven",
> "icmp.rtt.us": 4300,
> "monitor.ip": "192.168.1.66",
> "host.os.family": "debian",
> "host.architecture": "x86_64",
> "tags": "res1,ip1",
> "monitor.name": "icmp",
> "host.name": "smackcoders",
> "host.os.platform": "",
> "b": "kumar",
> "beat.version": 1.0,
> "icmp.requests": "1"
> },
> "March 14 2019, 18:51:09": {
> "monitor.status": " UP",
> "monitor.id": "icmp@icmp-ip@192.168.1.71",
> "beat.hostname": "smackcoders",
> "monitor.duration.us": 156959,
> "beat.name": "smackcoders",
> "host.os.codename": "xenial",
> "host.containerised": false,
> "host.os.version": "16.04",
> "host.id": "556b837c93cd4b8dbd3a1c01f468d8f4",
> "a": "steven",
> "icmp.rtt.us": 11400,
> "monitor.ip": "192.168.1.71",
> "host.os.family": "debian",
> "host.architecture": "x86_64",
> "tags": "res1,ip1",
> "monitor.name": "icmp",
> "host.name": "smackcoders",
> "host.os.platform": "",
> "b": "kumar",
> "beat.version": 1.0,
> "icmp.requests": "1"
> },
> }
> 
> ```

**Here's the config file of logstash:**

> input {  
> websocket {  
> url =\> "ws://192.168.1.27:10016"  
> codec =\> "json"  
> }  
> }  
> output {  
> elasticsearch {  
> hosts =\> "localhost"  
> index =\> "web\_socket"  
> document\_type =\>"web\_apps"  
> }  
> stdout{}  
> }

**Error i got:**

> [WARN] 2019-06-10 10:35:02.359 [[main]\<websocket] websocket - websocket input client threw exception, restarting {:exception=\>#\<HTTP::Parser::Error: invalid method\>}  
> [WARN] 2019-06-10 10:35:03.707 [[main]\<websocket] websocket - websocket input client threw exception, restarting {:exception=\>#\<HTTP::Parser::Error: invalid method\>}  
> [WARN] 2019-06-10 10:35:05.141 [[main]\<websocket] websocket - websocket input client threw exception, restarting {:exception=\>#\<HTTP::Parser::Error: invalid method\>}

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 10, 2019, 12:59pm UTC](https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917/2 "2019-06-10T12:59:49Z")

</div>

Your JSON is not valid JSON. It has a trailing , on the last element, preceding the final }

---

<div class="post-metadata">

**Author:** ![Smack\_Alpha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smack_alpha/32/43660_2.png) [@Smack\_Alpha](https://discuss.elastic.co/u/Smack_Alpha)\
**Post date:** [June 11, 2019, 5:02am UTC](https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917/3 "2019-06-11T05:02:10Z")

</div>

Thanks for the reply. I will fix it...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 9, 2019, 5:02am UTC](https://discuss.elastic.co/t/websocket-input-client-threw-expection/184917/4 "2019-07-09T05:02:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
