[
https://issues.apache.org/jira/browse/ARTEMIS-4961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
windy updated ARTEMIS-4961:
---------------------------
Summary: How to solve mqtt connection over websocket when visiting from
Wide Area Network IP by ws ? (was: How to solve mqtt connection over
websocket?)
> How to solve mqtt connection over websocket when visiting from Wide Area
> Network IP by ws ?
> ------------------------------------------------------------------------------------------------
>
> Key: ARTEMIS-4961
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4961
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker, MQTT
> Affects Versions: 2.17.0, 2.24.0
> Reporter: windy
> Priority: Major
> Attachments: 小Q截图-20240729152045.png
>
>
>
> !小Q截图-20240729152045.png|width=494,height=210!
> broker.xml:
> <acceptor
> name="wss">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
>
> {{{}testPage.html{}}}:
> {noformat}
> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="UTF-8" />
> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
> <title>MQTT over WebSocket</title>
> <script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
> </head>
> <body>
> </body>
> <script>
> const clientId = 'mqttjs_' + Math.random().toString(16).substring(2, 8)
>
> const connectUrl = 'wss://218.106.xxxxx:1883' //wlan ip
> const options = {
> keepalive: 30,
> clientId: clientId,
> clean: true,
> connectTimeout: 5000,
> username: 'test',
> password: 'test',
> reconnectPeriod: 1000
>
> }
> const topic = '/WebSocket/mqtt'
> const payload = 'WebSocket mqtt test'
> const qos = 0
> console.log('connecting mqtt client')
> const client = mqtt.connect(connectUrl, options)
> client.on('connect', () => {
> console.log('Client connected:' + clientId)
> client.subscribe(topic, { qos }, (error) => {
> if (error) {
> console.log('Subscribe error:', error)
> return
> }
> console.log(`Subscribe to topic ${topic}`)
> }
> )
> </script>
> </html>{noformat}
>
> artemis.log :
> 2024-07-30 13:34:25,017 WARN [DefaultChannelPipeline:1152] An
> exceptionCaught() event was fired, and it reached at the tail of the
> pipeline. It usually means the last handler in the pipeline did not handle
> the exception.: io.netty.channel.unix.Errors$NativeIoException:
> readAddress(..) failed: Connection reset by peer
> 2024-07-30 13:40:12,587 WARN [DefaultChannelPipeline:1152] An
> exceptionCaught() event was fired, and it reached at the tail of the
> pipeline. It usually means the last handler in the pipeline did not handle
> the exception.: io.netty.channel.unix.Errors$NativeIoException:
> readAddress(..) failed: Connection reset by peer
> hannel.unix.Errors$NativeIoException: readAddress(..) failed: Connection
> reset by peer[DefaultChannelPipeline:1152] An exceptionCaught() event was
> fired, and it reached at the tail of the pipeline
> io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed:
> Connection reset by peer2024-07-30 13:55:59,399 WARN
> [DefaultChannelPipeline:1152] An exceptionCaught() event was fired, and it
> reached at the tail of the pipeline. It usually means the last handler in the
> pipeline did not handle the exception.:
> io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed:
> Connection reset by peer
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact