# Websocket wrong number of requests

**URL:** <https://community.gatling.io/t/websocket-wrong-number-of-requests/4770>\
**Category:** Gatling (Open-Source)\
**Created:** [January 25, 2019, 9:32am UTC](https://community.gatling.io/t/websocket-wrong-number-of-requests/4770 "2019-01-25T09:32:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteDroid](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SteDroid](https://community.gatling.io/u/SteDroid)\
**Post date:** [January 25, 2019, 9:32am UTC](https://community.gatling.io/t/websocket-wrong-number-of-requests/4770/1 "2019-01-25T09:32:18Z")

</div>

Hi there,  
I am trying to make a comparison between HTTP and Websockets, but the number of requests per seconds is wrongly reported in the simulation for Websockets.

I simulate n users (n=5), each sending m requests (m=200).

On websockets, I am reported of 2 requests per user ( which is open websocket + close websocket), while actually I think the number of requests reported for each user should be : (2 + m) (open request + m send messages + close request).

Http instead reports m requests per user, which is right.

I dunno know if I’m actually missing some setting to achieve the desired result I need.

I post my code below.

Hope someone can reply soon 🙂

HTTP:

```auto
class HTTPSimulation extends Simulation {

  val httpProtocol = http
    .baseUrl("http://myUrl")
    .acceptHeader("application/json")
    .contentTypeHeader("application/json")

  val scn = scenario("HTTP")
    .repeat(200) {
            exec(http("http_test")
                    .post("")
                    .body(RawFileBody("http.json"))
                    .asJson
            )
            .pause(200.milliseconds)
     }

  setUp(
    scn.inject(atOnceUsers(5))
       .protocols(httpProtocol)
  )
}

```

WEBSOCKET

```auto
class A3ESimulation extends Simulation {

  val wsProtocol = http.wsBaseUrl("ws://myWsEndpoint")

  val scn = scenario("WebSocket")
    .exec(ws("connect").connect(""))
    .repeat(200, "i") {
         exec(ws("send ${i}").sendText(payload))
         .pause(200.milliseconds)
    }
    .exec(ws("close").close)

  setUp(
    scn.inject(atOnceUsers(5))
       .protocols(wsProtocol)
  )
}

```
