# WebSockets: Check didn't succeed by the time a new one was set up

**URL:** <https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603>\
**Category:** Gatling (Open-Source)\
**Created:** [October 29, 2014, 7:03am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603 "2014-10-29T07:03:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanmay](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@Tanmay](https://community.gatling.io/u/Tanmay)\
**Post date:** [October 29, 2014, 7:03am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603/1 "2014-10-29T07:03:47Z")

</div>

I am running performance tests using gatling. Gatling is scaling very well for API calls but i find consistent exceptions on websockets. I am not sure if it is a server-side or client-side issue. Ia ms ending websocket heartbeats and waiting for replies from the server using _check()_. The code goes like so:

```auto
...
val sendHeartBeat=repeat(repeatCount){
         .exec(
              ws("Send HeartBeat")
              .sendText("HeartBeatMessage")).exitHereIfFailed    
         .exec(
              ws("Check HeartBeat")
              .check(wsListen.within(3500).until(1))). exitHereIfFailed
         .pause(4000)
}
...

```

The problem arises at the check stage. I run my tests for an hour or so but a few “users” drop off giving **Check didn’t succeed by the time a new one was set up** error.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [October 29, 2014, 9:02am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603/2 "2014-10-29T09:02:26Z")

</div>

What probably happens is that the server heartbeat message is received before the check is set (atm, we don’t keep a “just in case” buffer).  
You probably want to set the check on the sendText.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 10, 2014, 10:19am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603/3 "2014-11-10T10:19:33Z")

</div>

Hi Tanmay,

I have good news: [Krisztian spotted the issue](https://github.com/gatling/gatling/issues/2359). Fixing!

Cheers,

Stéphane

---

<div class="post-metadata">

**Author:** ![Tanmay](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@Tanmay](https://community.gatling.io/u/Tanmay)\
**Post date:** [November 10, 2014, 10:22am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603/4 "2014-11-10T10:22:23Z")

</div>

Hey,  
Thanks, please keep me posted about the development.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 10, 2014, 10:28am UTC](https://community.gatling.io/t/websockets-check-didnt-succeed-by-the-time-a-new-one-was-set-up/1603/5 "2014-11-10T10:28:45Z")

</div>

Issue is fixed in repository. We’ll release 2.0.3 next week.
