WebSocket Error - Service Unavailable

Hi Team,

Today morning WebSocket is giving error when it calls on_error(error_message) in python
it displays below information; can you please check and advice

Handshake status 503 Service Unavailable -+-+- {'server': 'AkamaiGHost', 'mime-version': '1.0', 'content-length': '19', 'cache-control': 'max-age=0, no-cache, no-store', 'pragma': 'no-cache', 'expires': 'Wed, 25 Oct 2023 06:21:04 GMT', 'content-type': 'text/html', 'date': 'Wed, 25 Oct 2023 06:21:04 GMT', 'connection': 'keep-alive'} -+-+- b'Service Unavailable'

Hi @PaytmMoney

Can you please check on this

Hi @deeeepak as we are checking the issue, we request you to use reconnect feature of WebSocketClient of PMClient SDK. Please find below the link to python PMClient SDK -

You can use below sample code to create a websocket connection with reconnect feature enabled -

from pmClient.WebSocketClient import WebSocketClient

webSocketClient = WebSocketClient("your_public_access_token")

customerPreferences = []

preference = {
    "actionType": 'ADD',  # 'ADD', 'REMOVE'
    "modeType": 'LTP',  # 'LTP', 'FULL', 'QUOTE'
    "scripType": 'INDEX',  # 'ETF', 'FUTURE', 'INDEX', 'OPTION', 'EQUITY'
    "exchangeType": 'NSE',  # 'BSE', 'NSE'
    "scripId": '13'
}

customerPreferences.append(preference)


def on_open():
    # send preferences via websocket once connection is open
    webSocketClient.subscribe(customerPreferences)


def on_close(code, reason):
    # this event gets triggered when connection is closed
    print(code, reason)


def on_error(error_message):
    # this event gets triggered when error occurs
    print(error_message)


def on_message(arr):
    # this event gets triggered when response is received
    print(arr)


webSocketClient.set_on_open_listener(on_open)
webSocketClient.set_on_close_listener(on_close)
webSocketClient.set_on_error_listener(on_error)
webSocketClient.set_on_message_listener(on_message)

"""
set below reconnect config if reconnect feature is desired
Set first param as true and second param, the no. of times retry to connect to server shall be made  
"""
webSocketClient.set_reconnect_config(True, 5)

# this method is called to create a websocket connection with broadcast server
webSocketClient.connect()
1 Like

I am facing same issue–Received Error- Handshake status 503 Service Unavailable -±± {‘content-type’: ‘text/html; charset=utf-8’, ‘content-length’: ‘6337’, ‘x-robots-tag’: ‘noindex’, ‘expires’: ‘Tue, 15 Oct 2024 05:22:02 GMT’, ‘cache-control’: ‘max-age=0, no-cache, no-store’, ‘pragma’: ‘no-cache’, ‘date’: ‘Tue, 15 Oct 2024 05:22:02 GMT’, ‘connection’: ‘keep-alive’}
reconnect is not working in my case please help to check the issue.

I am also getting same error at my end, getting below excpetionjavax.websocket.DeploymentException: Handshake error.org.glassfish.tyrus.client.RetryAfterException: HTTP Status code 503 - Service Unavailable.stackTrace = {StackTraceElement[13]@5782}
0 = {StackTraceElement@5784} “org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:636)”
1 = {StackTraceElement@5785} “org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:673)”
2 = {StackTraceElement@5786} “java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)”
3 = {StackTraceElement@5787} “java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)”
4 = {StackTraceElement@5788} “java.base/java.util.concurrent.FutureTask.run(FutureTask.java)”
5 = {StackTraceElement@5789} “org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:826)”
6 = {StackTraceElement@5790} “java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)”
7 = {StackTraceElement@5791} “org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:496)”
8 = {StackTraceElement@5792} “org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:366)”
9 = {StackTraceElement@5793} “com.paytmmoney.equities.pmclient.ticker.WebSocketClient.connect(WebSocketClient.java:188)”
10 = {StackTraceElement@5794} “com.paytmmoney.equities.fetchData.MainReadWebSocketAndWriteToFiles.tickerUsage(MainReadWebSocketAndWriteToFiles.java:363)”
11 = {StackTraceElement@5795} “com.paytmmoney.equities.fetchData.MainReadWebSocketAndWriteToFiles.main(MainReadWebSocketAndWriteToFiles.java:122)”
12 = {StackTraceElement@5796} “com.paytmmoney.equities.pmclient.PMClientApplication.main(PMClientApplication.java:71)”

Date: 16 October 2024:
@eryan : is it working for you?, it not working for me and there is no response from paytm technical team on this issue

Date: 15th Ocotober 2024
now I am able to connect for brief moment , but it’s getting closed immediately with error ( Connection Closed: CloseReason[1006,Closed abnormally.]

Date : 16th Oct 2024 time 10:24 AM
same issue still persist (org.glassfish.tyrus.client.RetryAfterException: HTTP Status code 503 - Service Unavailable.) ,

@eryan : is it working for you? , mine is not working , let’s connect my gmaaail id is sktonger2 , thanks

Date: 15th October 2024, time: 11: 00 AM
Again getting below excpetionjavax.websocket.DeploymentException: Handshake error.org.glassfish.tyrus.client.RetryAfterException: HTTP Status code 503 - Service Unavailable.stackTrace = {StackTraceElement[13]@5782}
0 = {StackTraceElement@5784} “org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:636)”
1 = {StackTraceElement@5785} “org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:673)”
2 = {StackTraceElement@5786} “java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)”
3 = {StackTraceElement@5787} “java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)”
4 = {StackTraceElement@5788} “java.base/java.util.concurrent.FutureTask.run(FutureTask.java)”
5 = {StackTraceElement@5789}

@PaytmMoney ,Could you please check this issue

@PaytmMoney Any update on the mentioned issue.

Looks like very few customers are affected by this issue. LOL

Seems like its server based issue.

Error 503: Service Unavailable\n Description: The server is temporarily overloading or down

1 Like

It is not working today aswell

1 Like

@PaytmMoney Yep, facing the same problem since yesterday. 503 - Server is temporarily down / unavailable. Tried the python code for reconnecting : Reconnecting with Web Socket - #2 by Abhishek61

After some number of tries, there are responses coming from the server but then crashing again :frowning:

@genz @Yash @eryan @sktonger we are checking the issue, it will be resolved shortly.

1 Like

@genz @Yash @eryan @sktonger the issue is resolved, we request you to report any such issues directly on openapi.care@paytmmoney.com so that we can respond to you quickly and resolve to it as soon as possible.

3 Likes

Thank You @Peter for resolving this issue. Much appreciated.
As suggested, we will raise issues on openapi.care@paytmmoney.com if faced prolems again, hope it never arise.
Long live PaytmMoney. :slight_smile:

2 Likes