Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 29 13:04
    madosuki starred SuaveIO/suave
  • Jan 28 00:31
    delneg starred SuaveIO/suave
  • Jan 23 02:35
    severmat52 starred SuaveIO/suave
  • Jan 18 20:59
    ademar commented #723
  • Jan 18 20:59

    ademar on master

    Corrected default port from 808… Merge pull request #723 from Wa… (compare)

  • Jan 18 20:59
    ademar closed #723
  • Jan 18 18:20
    WallaceKelly commented #723
  • Jan 17 22:39
    WallaceKelly opened #723
  • Jan 17 21:23
  • Jan 07 03:51
    vijacques starred SuaveIO/suave
  • Jan 03 22:49
    trbarrett closed #721
  • Jan 03 22:49
    trbarrett commented #721
  • Jan 03 16:28
    ademar commented #720
  • Jan 03 16:14
    mamcx commented #720
  • Jan 03 16:01
    ademar commented #720
  • Jan 03 15:48
    mamcx commented #720
  • Jan 03 15:28
    ademar commented #720
  • Jan 03 14:34
    ademar commented #721
  • Jan 03 13:02
    trbarrett opened #721
  • Jan 03 01:54
    Nexus6 starred SuaveIO/suave
Victor Peter Rouven Müller
@realvictorprm
Hi fellows, I'm using the choose function to express my various post and get points. Now I would like to adjust that approach such that I can pass around data which may change between requests (and will be updated in the requests). Anyone got a clue what a solution could be ?
Diego Esmerio
@Nhowka
Have you check out warbler?
aflofo
@aflofo
Hey if I wanted to use the Websockets communication with Suave
Would I use Httpcontext to send the message
Or would I send it as a string through websockets
Ademar Gonzalez
@ademar
@aflofo have you seen the example here ?
aflofo
@aflofo
Yes many times
I ended up just making my own UserSession class and storing session data in a dictionary
btrepp
@btrepp
How do we get the logs out of Suave now?. It seems like all the docs point to using logary adapters (or to projects that have had logary ripped out), and either way of initializing the facade (via the adapters initialize or via createGeneric and parsing it in) seem to be exquivalent to piping to /dev/null
Tonino Lucca
@tonyx
@btrepp I'm using Log4net in the C#-ish way. So each modules declares log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) on top, then and I can use log.Debug() or something similar where I need, and it does work fine. There is the need to configure it by adding a proper log4net.config file, and a line like [<assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")>] in AssemblyInfo.fs. I don't remember exactly where I found such info. I just know it works anyway.
btrepp
@btrepp
@tonyx thanks. I've been mainly using owin+freya+httpsys listeners, and was wondering if I could switch to suave. I got the web server up super quick, and despite using logary myself for the app, I haven't managed to get suaves logs at all.
ImaginaryDevelopment
@ImaginaryDevelopment
can I get at the mac address of the requester? or anything like that?
@haf I wanted a single thing I could use for either pathScan or sprintf
Kristian Lundström
@Mousaka

I'm a suave and f# beginner having a question: Why do you want to run a Suave as a .fsx script and why not as a .fs?

I've gone down the .fs road but I got stuck trying to get Suave to work in my app together with docker... "Console.ReadKey true |> ignore" doesn't seem to work in a Docker environment for some reason and without it my Suave app just exits immediately. Any tips?

Ademar Gonzalez
@ademar
@Mousaka You do not need to run it as a .fsx script; in fact I never do that. And you shouldn't need to use Console.ReadKey as startWebServer is a blocking call.
Kristian Lundström
@Mousaka

@ademar Thanks for the tip. I've basically only copied the code on the suave introduction page: https://suave.io/index.html

open System
open System.Threading
open Suave

[<EntryPoint>]
let main argv = 
  let cts = new CancellationTokenSource()
  let conf = { defaultConfig with cancellationToken = cts.Token }
  let listening, server = startWebServerAsync conf (Successful.OK "Hello World")

  Async.Start(server, cts.Token)
  printfn "Make requests now"
  Console.ReadKey true |> ignore

  cts.Cancel()

  0 // return an integer exit code

but if I remove Console.ReadKey it becomes nonblocking.

Is the key not to use startWebServerAsync and rather use startWebServer as u mentioned?

  • trying it out now *
Kristian Lundström
@Mousaka
seems to have done the trick =) thank you! Now I have some port problem with docker but that's at least a new problem
farzadfusion
@farzadfusion
Hi Folks, I am just wondering how I can make Suave Webserver to start automatically in Linux in startup ? Should I create a Daemon ?
Heart Force Medical, Inc.
@HeartForceMedical
Further to question from @farzadfusion, there is an example of a service file in a response to Issue #218. Unfortunately, that example hasn't worked for our deployment of a Suave server on Digital Ocean. SuaveIO/suave#218
Ademar Gonzalez
@ademar
Leon Ingelse
@leoningelse_gitlab
Hi Guys, I'm trying to make a hidden field in a form page. I cannot find any information on it anywhere, any help?
Tonino Lucca
@tonyx
@leoningelse_gitlab I think one trick is using javascript to manipulate a field on the fly, to hide it. It looks spooky, but it works. I tried it. Another possibility is just using dotliquid templating. (I used both, until I realized I didn't need hidden field at all!)
Leon Ingelse
@leoningelse_gitlab
@tonyx Thank you for your reply! Would you maybe have some example code snippet?
Ademar Gonzalez
@ademar
@leoningelse_gitlab not sure I follow; if you are coding HTML a simple hidden field would look like this
<input type="hidden" id="custId" name="custId" value="3487">
Tonino Lucca
@tonyx
Leon Ingelse
@leoningelse_gitlab
@tonyx Thank you so much! You have helped me a lot :)
Tonino Lucca
@tonyx
@leoningelse_gitlab welcome
Harald Steinlechner
@haraldsteinlechner
hi. i'm trying to revive suave proxy functionality as existing here: https://searchcode.com/codesearch/view/109236858/
unfortunately without success yet. there is too much api changes and without insights into internals. this is my current state: https://gist.github.com/haraldsteinlechner/0b3eb4eea492162d223c6f3d5516f744
Harald Steinlechner
@haraldsteinlechner
i restored a much newer version of proxy but in the end i'm stuck with: type HttpConsumer =
| WebPart of WebPart
| SocketPart of (HttpContext -> Async<(HttpContext -> SocketOp<HttpContext option>) option >)
what happened to socketpart?
Ademar Gonzalez
@ademar
yeah we dropped SocketPart and proxy at some point .. still i think it should be possible to shape the function proxy into a webpart .. just change it a bit till you get the correct signature .. I'll look into it later today if you don't beat to me to it .. i will very much would like to have proxy back in
Harald Steinlechner
@haraldsteinlechner
hm i made some progress
what was the idea of heaving to different delayed httpcontexts here in the first place?
Harald Steinlechner
@haraldsteinlechner
cool!
Harald Steinlechner
@haraldsteinlechner
ok this response_f was the problem. wihtout it works at least with http.
Harald Steinlechner
@haraldsteinlechner
ok this is my progress. currently i'm struggling to support websockets... haraldsteinlechner/suave2@939d52e
Harald Steinlechner
@haraldsteinlechner
any ideas how to proceed with websockets? what i found:
  • UriBuilder does not support ws prefix
  • using custom websocketrequest here might be crazy?
  • can we reuse other suave ws infrastructure here?
Harald Steinlechner
@haraldsteinlechner
also, i'm not sure, i think my current implementation is superslow, since all is on a per-request level? for websockets we could initiate handshake at some point, if we are sure it is on per-connection level. iwould be great if you can think this stuff through.
cagyirey
@cagyirey
is there any way to call WebSocket.send without using the socket computation expression? I'm trying to call it in an event handler, but I don't think there's a way to do that since WebSocket.send needs to be top-level in the socket expression
Ademar Gonzalez
@ademar
this is where it gets complicated .. for proxying it would be optimal if suave didn't waste time parsing POST payloads or websockets segments and it just copied the bytes over. this is not possible to express in the webpart paradigm .. it would need to be built out of more fundamental constructs.
Ademar Gonzalez
@ademar
@cagyirey not sure i follow you could use Async.RunSynchronously <| websocket.send
Tonino Lucca
@tonyx
Hi, I ported a small Suave program from mono to .net core. Basically now I can run "dotnet run" and it works. But the webserver seems unable to retrieve files like .css and images. The webpart contains an entry like pathRegex "(.*).(css|gif|js|png|jpeg|jpg|)" >=> Files.browseHome, and I tried making the jpeg files and the css available under the current dir , and also the dir where the assembly is deployed (i.e. bin/Debug/netcoreapp2.1), but seems impossible to see those files. Help is appreciated. Thanks. Ciao.
Tonino Lucca
@tonyx
never mind. I found how to do it: changing homeFolder in defaultConfig (that was not necessary when using mono instead of .netcore)
joebo
@joebo
hello - what is the right way to deal with settings in a suave app? I know I can use environment variables but if there's many would an appsettings.json be the right way to go?
dyoshikawa
@dyoshikawa
hi, i’m F# lang and suave newbie.