Can't use webread on nodejs local server in Matlab mobile

3 views (last 30 days)
Trung Nghia Pham
Trung Nghia Pham on 24 Oct 2021
Commented: Trung Nghia Pham on 30 Oct 2021
I am using nodejs with express framework and javascript code to create a local responsive server like this
const express = require('express');
const app = express();
app.listen(8080, '', function() {
console.log("On port 8080");
app.get('/', (req, res) => {
console.log('someone asking');
The server is operational when I access to 'http://(myIp):8080'by web browser. Also i use webread in Matlab to get data from node server (webwrite to send back data). It worked well in my laptop Matlab software. Not until i used that function in Matlab mobile or Matlab on web browser, it always got timeout, eventhough i set web timeout to inf like this
myUrl = 'http://(myIp):8080';
myOpt = weboptions('timeout', inf);
myRes = webread(myUrl, myOpt)
Error using webread (line 136)
The connection to URL 'http://(myIp):8080' timed out after 5.000 seconds. The reason is "Connection timed out after 5100 milliseconds". Perhaps the server is not responding or weboptions.Timeout needs to be set to a higher value.
webread in Matlab mobile still works with other urls that response data like ''. Did i get wrong somewhere or is this an impossible task for any reasons? Somebody, please help me!

Answers (1)

Yongjian Feng
Yongjian Feng on 24 Oct 2021
When you said "i used that function in Matlab mobile or Matlab on web browser", where do you run your server? You local laptop as well?
Matlab on web browser means matlab online?
Trung Nghia Pham
Trung Nghia Pham on 30 Oct 2021
Is there anything I can do to reach the goal, which is sending datas from matlab mobile to local server?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!