Questions tagged [vibed]

vibe.d is an async i/o and web programming framework for D.

vibe.d is an async i/o and web programming framework for D. http://vibed.org/

70 questions
1
vote
1 answer

Is there a way to run a task each day at a 8:00 AM in vibed?

I'm trying to run a task each day at 8:00 AM in a vibe.d web app. For the moment, I use the setTimer function with the periodic parameter to true. But this way, I can't control exactly the hour at which the task will be triggered. Is there an easy…
moppag
  • 956
  • 9
  • 17
1
vote
1 answer

Exception after connection to DB with mysql-native driver

I want to create to function. The first one is connect to DB, the second one is complete reconnection if first is failed. In my experiment I turn off DB at start to get connect block failed and call reconnect block. After it I am turning on DB, and…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
2 answers

Database connection pattern

I use mysql-native. This driver is suppport vibed's connection pool. On dlang newsgroup mysql-native developer Nick Sabalausky wrote: "If you're using a connection pool, you shouldn't need to worry about closing the connection. The whole point is…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

Creating new types using Typedef on Vibe.data.json.Json, implicit conversion error

I needed to have multiple types of Json so I used Typedef as following: alias NewType = Typedef!(Json); I am using Vibe.d Json version, I get the following message when compiling using DMD64 D Compiler v2.072.0: Error: cannot implicitly convert…
Qurashi
  • 1,449
  • 16
  • 27
1
vote
3 answers

vibed: Can't get routing work

I am trying to get to work very simple vibed routing: void main() { config = new Config(); auto router = new URLRouter; router.get("/*", serveStaticFiles(roothtml ~ "\\")); router.get("files/*", serveStaticFiles("./files/")); …
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

Is Vibe.D multi-threaded to handle concurrent requests?

I know that Vibe.D implementation is based on Fibers. But I don't know how high load scenarios are handled by Vibe.D. Is it the scheduler in Vibe.D allocating fibers on multiple threads or just one thread for all fibers? This consideration is very…
1
vote
1 answer

Anyone knows if vibe.d supports HTTP Byte-Range while serve static files?

I was looking in the source code of vibe-d-0.7.28 but fileserver.d doesn't show any light about this. Actually, the sendFileImpl() function is the main implementation for that job and doesn't have any reference to byte-range header. Do you know if…
1
vote
1 answer

What IP I should to specify to get vibed to work on server?

I have got next situation. There is site. One sub-domain of it map to server inside our network to nonstandard port. Example: foo.domain.com is map to 85.169.223.158 to port 8083. Which setting I should set in vibed, to get it work? The default…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

Why browser get response from vibed so slowly?

I am sending data from browser to vibed. On vibed console I am getting request instantly. But in browser console I need two wait for console.log 5-8 seconds. And I can't understand where is problem. postQuestionsContent : function() { …
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

Why we should pass pointer in listenHTTP to &handleRequest?

I am reading vibed examples and can't understand next moment: import vibe.d; shared static this() { auto settings = new HTTPServerSettings; settings.port = 8080; listenHTTP(settings, &handleRequest); } void…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

How to send error response with JSON body

I need to send JSON response with, for example, 403 HTTP error code. How can I achieve this in vibe.d? I currently use this code: T enforceCode(T)(HTTPServerResponse res, T value, ErrorCodes code, HTTPStatus status = HTTPStatus.forbidden) { …
sigod
  • 3,514
  • 2
  • 21
  • 44
1
vote
1 answer

Vibed: error: 411 Length Required

I am trying to get server response code with next code: import std.stdio; import vibe.core.log; import vibe.http.client; import vibe.stream.operations; import vibe.http.status; void main() { requestHTTP("http://www.example.org/", (scope…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
1 answer

How to convert associative array to key:value?

I need to convert associative array, to put them to Json, but I can't understanf how to do it. Method to!string add unnecessary slashes. int[string] name; name["Python"] = 5; Json tags = Json.emptyObject; //Json object tags["tags"] =…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
1
vote
0 answers

How to check MongoDB connection status in D?

As far as I understand from docs vibed have 2 was API for MongoDB 1. Low level 2. Hight level Low level API have connection property, so I can connect to DB and check if connection is success with next code: auto db = new…
Suliman
  • 1,469
  • 3
  • 13
  • 19
1
vote
1 answer

How to check internet connection status with vibed?

Before app start I need to check if Internet connection is up. What is the best way to do this? I am using vibed. I wrote next code: import std.stdio; import std.string; import std.conv; import vibe.d; import vibe.core.log; import…
Suliman
  • 1,469
  • 3
  • 13
  • 19