My server keeps listening to port 8000, even after I’ve modified the main.tsx to include:
await start(manifest, { port: 3000 });
I guess you have added that line after the existing
await start(manifest, { render });
Then it doesn't work. Instead modify the existing line to
await start(manifest, { render, port: 3000 });
I did it after the server was started with
deno task start
and got
Watcher File change detected! Restarting!
Server listening on http://localhost:3000
Related
I host a very simple node socket IO application on my Window Server, below are the code sample.
// socket.io 3.1.2"
const port = 30080;
const httpServer = require("http").createServer();
const io = require("socket.io")(httpServer, {
cors: {
origin: '*',
methods: ["GET", "POST"],
allowedHeaders: ["Access-Control-Allow-Origin"],
credentials: false
}
});
io.on("connection", socket => {
console.log('On Connection');
io.emit("message", 'Welcome to Socket Io.');
});
And I wrote some code to try connect to my socket IO server in a HTML File and work well. below are the code sample.
// <script src="https://cdn.socket.io/3.1.3/socket.io.min.js"></script>
const socket = io("http://myserverip:30080", {
withCredentials: false,
extraHeaders: {
"Access-Control-Allow-Origin": "*"
}
});
socket.on("connect", () => {
console.log('connect');
});
socket.on("message", (message) => {
console.log(message);
});
But when I try to use those above code in my .NET Core web application, I get the error "ERR_SSL_PROTOCOL_ERROR". Even I publish my web application on the Window Server still getting the same error message.
I have tried http, https, ws and wss protocol. None of these work. How can I get this possibly working?
I do not see the following in your server side code:
httpServer.listen()
Do you have a reverse proxy between your client and the server?
I would expect no SSL related error based on you code.
I would also use socket.io version 4 just for future maintenance reasons.
I am learning MQTT and I deployed the open source mosca broker to an azure web app. The problem is the broker works between 2 pcs but When I try to connect my arduino nano to the broker it always fails. Here is my server code:
//Mosca
const mosca = require('mosca')
const settings = {
http: {
// port for websockets, MQTT is running in default port 1883
port: 8000,
bundle: true,
static: './public'
}
}
// start mosca
const moscaServer = new mosca.Server(settings)
moscaServer.on('ready', setup)
// fired when the mqtt server is ready
function setup() {
console.log('Mosca server is up and running in port 1883!')
console.log('Using port 8000 for MQTT over Web-Sockets!')
}
// fired when a client is connected
moscaServer.on('clientConnected', function(client) {
console.log('client connected', client.id)
})
// fired when a message is received
moscaServer.on('published', function(packet, client) {
//if (packet.topic == '/example') {
console.log(packet.payload.toString('utf-8'))
//}
})
// fired when a client subscribes to a topic
moscaServer.on('subscribed', function(topic, client) {
console.log('subscribed : ', topic)
})
// fired when a client unsubscribes to a topic
moscaServer.on('unsubscribed', function(topic, client) {
console.log('unsubscribed : ', topic)
})
// fired when a client is disconnecting
moscaServer.on('clientDisconnecting', function(client) {
console.log('clientDisconnecting : ', client.id)
})
// fired when a client is disconnected
moscaServer.on('clientDisconnected', function(client) {
console.log('clientDisconnected : ', client.id)
})
From Azure App Service WebApp stand-point - by default, App Service assumes your custom container is listening on port 80. If your container listens to a different port, set the WEBSITES_PORT app setting in your App Service app.
A WebApp can be accessed via the internet is through the already-exposed HTTP (80) and HTTPS (443) TCP ports.
App Service currently allows your container to expose only one port for HTTP requests.
I’m not much sure about - MQTT broker. Also, how exactly you're attempting to connect.
From App Service- Docker Compose options-Kindly checkout the doc, Supported and Unsupported configuration.
• Only one container can be open for access
• Only port 80 and 8080 is accessible (exposed ports)
Kindly refer this document for more details.
Note: Web Sockets are supported on Linux apps.
I'm trying to run a Deno app with a deno_webview and an http server but for some reason I cannot run both at the same time, calling webview.run() seems to block something and I can no longer reach my http server.
In order to prevent the blocking, I'm trying running either the server or the webview in a webworker, but in both scenarios I get the same error "Cannot find name 'window'"
What is the issue here?
api.webworker.ts
import { Application } from 'https://deno.land/x/oak/mod.ts';
const app = new Application();
await app.listen({ port: 8080 });
webview.webworker.ts
import { WebView } from 'https://deno.land/x/webview/mod.ts';
const webview = new WebView({ url: 'http://localhost:4200' });
await webview.run();
server.ts
const webviewWorker = new Worker(
'./workers/webview.worker.ts', {
type: 'module',
deno: true
});
Error:
const apiWorker = new Worker(
'./workers/api.worker.ts', {
type: 'module',
deno: true
});
Error:
Web Workers don't have window object, you have to use self or globalThis
So https://deno.land/x/webview/mod.ts doesn't support being called from a Web Worker.
The library will need to change window usage to globalThis so it will work int the main process and inside workers.
I was setting up a Deno server to handle HTTPS request, I used self signed certificates to do the job.
Used below code for this:
import { serveTLS } from "https://deno.land/std/http/server.ts";
const body = new TextEncoder().encode("Hello HTTPS");
const options = {
hostname: "localhost",
port: 443,
certFile: "./path/to/localhost.crt",
keyFile: "./path/to/localhost.key",
};
// Top-level await supported
for await (const req of serveTLS(options)) {
req.respond({ body });
}
I ran this code as: deno --allow-net --allow-read app.ts
I get following error:
ERROR RS - rustls::session:571 - TLS alert received: Message {
typ: Alert,
version: TLSv1_3,
payload: Alert(
AlertMessagePayload {
level: Fatal,
description: BadCertificate,
},
),
}
error: Uncaught InvalidData: received fatal alert: BadCertificate
► $deno$/errors.ts:57:13
at InvalidData ($deno$/errors.ts:135:5)
at constructError ($deno$/errors.ts:57:13)
at unwrapResponse ($deno$/dispatch_json.ts:41:12)
at sendAsync ($deno$/dispatch_json.ts:96:10)
Is it possible to use self signed certificates with Deno ?
What went wrong and how to fix it ?
It was a problem with my certificate files, strangly the same certificates were working with nodejs.
I created local certificates and key than using this mkcert, then it worked!
If you're on MacOS, the best way to fix this is to instruct Deno to look at the system as the CA store.
Run this, then try again to see if you still get a warning/error:
export DENO_TLS_CA_STORE=system
You probably also want this in your .bash_profile as well.
I have a Meteor App based on Angular 1.3 + Meteor 1.5.2.2.
I am using Ubuntu 17.
I am trying to deploy my Meteor App on local machine first before going for live server using Meteor Up.
But I am facing this issue when running mup setup command
martinihenry#martinihenry:~/mytestapp-prod/.deploy$ mup setup
Started TaskList: Setup Docker
[192.168.100.12] - Setup Docker
events.js:141
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 192.168.100.12:22
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1078:14)
Here is my mup.json:
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: '192.168.100.12',
username: 'root',
// pem: './path/to/pem'
// password: 'server-password'
// or neither for authenticate from ssh-agent
}
},
app: {
// TODO: change app name and path
name: 'mytestapp-prod',
path: '../',
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: '192.168.100.12:3000',
MONGO_URL: 'mongodb://localhost/meteor',
},
// ssl: { // (optional)
// // Enables let's encrypt (optional)
// autogenerate: {
// email: 'email.address#domain.com',
// // comma separated list of domains
// domains: 'website.com,www.website.com'
// }
// },
docker: {
// change to 'kadirahq/meteord' if your app is using Meteor 1.3 or older
image: 'abernix/meteord:base',
},
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},
mongo: {
version: '3.4.1',
servers: {
one: {}
}
}
};
What could be wrong here?
It looks like you don't have sshd running on your machine, or you have not enabled remote ssh access for root.
You need to edit /etc/ssh/sshd_config, and comment out the following line:
PermitRootLogin without-password
Just below it, add the following line:
PermitRootLogin yes
Then restart SSH:
service ssh restart
I know this is late, but this a known and reproducable bug resulting from inotfiy-watch using all of the available slots for watches, and while very misleading, it actually has absolutely nothing to do with disk space.
The easy fix? increase watch slots:
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit