# Websocket input plugin

**URL:** <https://discuss.elastic.co/t/websocket-input-plugin/176744>\
**Category:** Logstash\
**Created:** [April 13, 2019, 5:46pm UTC](https://discuss.elastic.co/t/websocket-input-plugin/176744 "2019-04-13T17:46:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamed\_eshaftri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohamed_eshaftri/32/43987_2.png) [@Mohamed\_eshaftri](https://discuss.elastic.co/u/Mohamed_eshaftri)\
**Post date:** [April 13, 2019, 5:46pm UTC](https://discuss.elastic.co/t/websocket-input-plugin/176744/1 "2019-04-13T17:46:17Z")

</div>

hello,

i need to use Websocket input plugin for indexing json data in to elasticsearch.

this my code in javascript.

```
<script>
        var ws = new WebSocket(" wss://ws.blockchain.info/inv");
        ws.onopen = function(){
            ws.send(JSON.stringify({"op":"unconfirmed_sub"}))
            console.log('mash')

        };
        ws.onmessage = function(msg){
            var response = JSON.parse(msg.data);
            console.log('response')
        }

    </script>

```

i am trying to implement the js code in Websocket input plugin, and below my Websocket input plugin config code.

```
input {
    websocket {
      mode => "client"
      url => "wss://ws.blockchain.info/inv"
      type => "string"
    }
  }

  output {
    elasticsearch {
      hosts => ["localhost:9200"]
      index => "calidog"
    }
    stdout { codec => rubydebug }
  }

```

when i run the config file

```
[2019-04-13T18:15:16,387][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=>9600}
[2019-04-13T18:15:21,190][INFO][logstash.runner] Logstash shut down.

```

Thanks 🙂

---

<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:** [May 11, 2019, 5:46pm UTC](https://discuss.elastic.co/t/websocket-input-plugin/176744/2 "2019-05-11T17:46:18Z")

</div>

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